You could provide the order by as an extra (optional) parameter. The
signature for order by can be taken from
http://msdn.microsoft.com/en-us/library/bb341409 and this way you can
apply it only on the list query. Expression (probably) has methods to
combine the two expressions.
On Wednesday, May 23, 2012 3:09:34 AM UTC+2, Felipe Oriani wrote:
>
>
> Hello Guys, I have an extension method for my queries to page it, this is
> the code:
>
> public static PagedList<T> ToPageList<T>(this IQueryOver<T, T>
> query, int size, int index)
> {
> int total = query.Clone().FutureRowCount();
> var list = query.Take(size).tSkip((index -
> 1)*size).Future<T>();
>
> return new PagedList<T>(list, total, size, index);
> }
>
> It works fine, but when I use an order by method (on my queryover), the
> Nhibernate process this order by command on the count query.
> My question is, is there any way to remove the order by from the QueryOver
> to NHibernate count it without order by?
>
> Or if anyone has any suggestions to improve this method, I would
> appreciate.
>
> PS: I use it with asp.net mvc
>
> Thank you!
>
>
> --
> ______________________________________
> Felipe B. Oriani
> felipeoriani.com.br [email protected]
> @felipeoriani<http://www.twitter.com/felipeoriani>
> LinkedIn <http://br.linkedin.com/in/felipeoriani>
> Facebook<http://www.facebook.com/felipeoriani>
> Contato: (19) 9611-8646 / (19) 3421-7850
>
> "...Trabalhe quanto puder, tornando-se útil quanto possível..." , por
> André Luiz
>
>
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/nhusers/-/-VZsmX85IosJ.
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.