Maybe there are other solutions, but one way is to do ToList() before
OrderBy(). The ordering will then happen in your application, instead
of in SQL. You would need the code from your second try of course, to
avoid null reference exceptions.

/Oskar


2010/6/24 Kakone <[email protected]>:
> 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].
> 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