Yes Yes. Here is a simple example:
var blogs = _session.Query<Blog>() .Take(30) .ToFuture(); var blogCount= _session.Query<Blog>() .ToFutureValue(x => x.Count()); Console.WriteLine(blogCount.Value);
Here is an example of where I used it for a customer search form that displayed page search results and the total number of search results. Note that you can reuse IQueryable to create two futures. Filter methods built IQueryable depending on what fields the user searched for.
int resultsPerPage = 50; var query = _session.Query<CustomerSearch>() .FilterById(model) .FilterByFirstName(model) .FilterByLastName(model) .FilterBySocialSecurityNumber(model) .FilterByPrimaryPhoneNumber(model); var futureResults = query .OrderBy(x => x.Id) .Skip(model.Page * resultsPerPage) .Take(resultsPerPage) .ToFuture(); var futureCount = query.ToFutureValue(x => x.Count());
Ryan hauert
source share