I’m interested on solution how to use Futures in counting something having Linq in mind. I’m not interested in Criteria api, just plain linq.
If I have:
IEnumerable<User> dbUsers = userquery.Future<User>();
IFutureValue<long> count = totalcountQuery.FutureValue<long>();
direct translation should be:
var dbUsers = userQuery.ToFuture();
var count = userQuery.LongCount();
Now I need to access count query to know exact number of populated records;
something like this, although this code wont compile:
totalRecords = (int)count.Value;
This is not directly supported by NHibernate, but it is very easy to implement (explained in this blog post). You need to write a new extension method.
Then it is easy to get a paged query