You can do left join in the QueryOver API (very similar to LINQ method
chaining) you can do something like:

session.QueryOver<Project>().Left.JoinQueryOver(p => p.Type).OrderBy(p =>
> p.Type.Label).Take(...);
>

(warning: not tested, try also session.QueryOver<ProjectType>() if
p.Typedoesn't work. I haven't tried the code and there is no XML
documentation to
advise)


Regards,

--
Mohamed Meligy
Senior Developer (Microsoft Technologies - Technical Delivery)
Injazat Data Systems
P.O. Box: 8230 Abu Dhabi, UAE
[ Local Time Offset:  GMT +4 ]

Direct:  +971   2 4045385
Mobile: +971 50 2623624, +971 55 2017 621

E-mail: [email protected]
Weblog: http://gurustop.net


On Thu, Jun 24, 2010 at 5:43 PM, Diego Mijelshon <[email protected]>wrote:

> Hmmm... it's slightly unexpected as a behavior, although it's consistent
> with the equivalent HQL:
>
>   from Project order by Project.Type.Label
>
> It generates an inner join (actually, a select from two tables with a where
> clause)
>
> With HQL you can use explicit left joins:
>
> select project
>  from Project project
> left join project.Type as type
>  order by type.Label
>
> But I don't know if it's possible with Linq...
>
>    Diego
>
>
>
> On Thu, Jun 24, 2010 at 08:59, Kakone <[email protected]> wrote:
>
>> Hello,
>>
>> I have a project class with a Type property (it's a nullable reference
>> to a ProjectType entity).
>>
>> I want to order like this :
>> Session.Query<Project>().OrderBy(p.Type.Label).ToList()
>> When I do this, I don't get the objects where Type property value is
>> null.
>>
>> So, I tried to write this :
>> Session.Query<Project>().OrderBy(p => p.Type == null ? null :
>> p.Type.Label).ToList()
>> But, in this case, I've got an exception : "No persister for :
>> xx.xxx.EntityBase"
>>
>> What can I do to get all the objects including those with Type ==
>> null ?
>>
>>
>> Cordially,
>> Kakone.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "nhusers" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected]<nhusers%[email protected]>
>> .
>> For more options, visit this group at
>> http://groups.google.com/group/nhusers?hl=en.
>>
>>
>  --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<nhusers%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/nhusers?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en.

Reply via email to