I think it is not even possible.... i've seem the specification here: https://nhibernate.svn.sourceforge.net/svnroot/nhibernate/trunk/nhibernate/src/NHibernate.Test/NHSpecificTest/Futures/LinqFutureFixture.cs but I'm not sure.
If it is not supported, i think the best syntax will be something like this: queryable.ToFutureValue(q => q.Count()); this will allows other stuff like: products.ToFutureValue(prods => prods.Max(p => p.Price)); 2010/12/16 Bart Schapendonk <[email protected]> > How can I use a .ToFutureValue() on the Count() part of the code > snipped below. > In QueryOver there is a ToRowQountQuery() > > // PagedResults class > public class PagedResults<T> > { > private readonly IFutureValue<int> _count; > > public int Count { get { return _count.Value; } } > > public IEnumerable<T> Results { get; private set; } > > public PagedResults(IFutureValue<int> count, IEnumerable<T> > result) { _count = count; Results = result; } > } > > // QueryOver works > public static PagedResults<T> AsPagedResult<T>(this IQueryOver<T, T> > queryable, int pageSize, int pageNumber) > { > return new > PagedResults<T>(queryable.ToRowCountQuery().FutureValue<int>(), > queryable.Skip((pageNumber - 1) * pageSize).Take(pageSize).Future()); > } > > // How to do this using Linq? > public static PagedResults<T> AsPagedResult<T>(this IQueryable<T> > queryable, int pageSize, int pageNumber) > { > return new PagedResults<T>(queryable.Count().[ToFutureValue()], > queryable.Skip((pageNumber - 1) * > pageSize).Take(pageSize).ToFuture()); > } > > -- > 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]<nhusers%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/nhusers?hl=en. > > -- 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.
