C# 从nhibernate标准api到linq的查询

C# 从nhibernate标准api到linq的查询,c#,linq,nhibernate,nhibernate-criteria,C#,Linq,Nhibernate,Nhibernate Criteria,我想将以下查询从nhibernate标准查询api转换为linq var userquery = session.CreateCriteria(typeof(User)) .SetFirstResult(pageIndex * pageSize) .SetMaxResults(pageSize); var totalcountQuery = CriteriaTransformer.Clone(userquery) .SetPro

我想将以下查询从nhibernate标准查询api转换为linq

 var userquery = session.CreateCriteria(typeof(User))
          .SetFirstResult(pageIndex * pageSize)
          .SetMaxResults(pageSize);

 var totalcountQuery = CriteriaTransformer.Clone(userquery)
           .SetProjection(Projections.RowCountInt64());
谢谢

更新

IEnumerable<User> dbUsers = userquery.Future<User>();
IFutureValue<long> count = totalcountQuery.FutureValue<long>();
IEnumerable dbUsers=userquery.Future();
IFutureValue count=totalcountQuery.FutureValue();
直接(ish)翻译应为:

var userQuery = session.Query<User>().Skip(pageIndex * pageSize).Take(pageSize);

var totalCount = userQuery.LongCount();

我需要在实现自定义成员资格提供程序,谢谢虽然问题是更新的,你能翻译这增加了两行在linq,谢谢
var totalCount = session.Query<User>().LongCount(); 
var users = userQuery.ToFuture();    
var totalCount = userQuery.LongCount(); // users will be a future, count won't be but if it's only 2 queries then this will execute them both