Getting count with NHibernate + Linq + Future
问题 I want to do paging with NHibernate when writing a Linq query. It's easy to do something like this: return session.Query<Payment>() .OrderByDescending(payment => payment.Created) .Skip((page - 1)*pageSize) .Take(pageSize) .ToArray(); But with this I don't get any info about the total number of items. And if I just do a simple .Count(), that will generate a new call to the database. I found this answer which solved it by using future. But it uses Criteria. How can I do this with Linq? 回答1: The