Hi. all
I use NHibernate 3.2 alpha2 using LINQ query.
It's great! and wonderful! but I found some confused issue when using
skip-take Linq.
Here is my Pagination action method.
public PagedList(IQueryOver<T> source, int pageIndex, int pageSize)
{
TotalCount = source.RowCount();
PageSize = pageSize;
PageIndex = pageIndex;
AddRange(source.Skip(pageIndex * pageSize).Take(pageSize).List());
}
this code is so good when using another LINQ sequence. but it's not
worked in NHibernate.
So, I checked the SQL query, and found a issue.
Here is working code using NHibernate LINQ
public PagedList(IQueryOver<T> source, int pageIndex, int pageSize)
{
TotalCount = source.RowCount();
PageSize = pageSize;
PageIndex = pageIndex;
AddRange(source.Skip(pageIndex * pageSize).Take((pageIndex +1)*
pageSize).List());
}
why does this reason? why Take action is so confused ?
--
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.