I am using Nhibernate 3.0 and need to implement paging onto a site. Basically we have a ProductCategory which has a collection of Products associated with it. So far I have this which does work
var result = Session.QueryOver<TEntity>().TransformUsing(Transformers.DistinctRootEntity)
.Where(category => category.CategoryId == criteria.CategoryId)
.Fetch(category => category.Products).Eager
.Take(pageSize)
.Skip((pageIndex - 1)*pageSize)
.Future<TEntity>();
This returns me the category I am requesting and the child products paged correctly based on the page size and page index passed in.
What I want to do now is actually get the total row count of the products, so for example, even though I am only returning 5 products for example, I need to know that there are 100 in total.
Many Thanks