Another workaround could be:
session.Query<Article>().Take(4).AsEnumerable().OrderBy(a =>
a.DateCreated).ToList();


On 15 Dez., 10:45, Fabian Schmied <[email protected]> wrote:
> Hi,
>
> > var test = session.Query<Article>().OrderBy(a =>
> > a.DateCreated).ToList();
> > var test2 = session.Query<Article>().Take(4).OrderBy(a =>
> > a.DateCreated).ToList();
>
> Are you sure that you want the OrderBy to occur _after_ the Take? With
> the semantics of LINQ, this means that you first take four unordered
> items, then order those four items by DateCreated. Usually, you
> actually want the ordering to occur first:
>
> var test2 = session.Query<Article>().OrderBy(a =>
> a.DateCreated).Take(4).ToList();
>
> (If you really need OrderBy wo work after Take - ie., taking items,
> then reordering them -, I suggest you create a JIRA ticket for this.
> Or, if the ticket already exists, vote for it and maybe attach your
> sample to the ticket.)
>
> Fabian

-- 
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