我有以下 QueryOver:
var q = Session.QueryOver<CostCenter>().Where(c => c.PrimeCompany.Id == idPrimeCompany);
我需要克隆 QueryOver 但没有“where 子句”。这可能吗?
最佳答案
使用根实体(调用 session.QueryOver<> 时使用的类)并构建新查询
var roottype = theQueryOver.UnderlyingCriteria.GetRootEntityTypeIfAvailable();
var totalCount = session.CreatCriteria(roottype).SetProjection(Projections.RowCount()).UniqueReasult<long>();
关于nhibernate - 如何无条件克隆 Nhibernate QueryOver?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30350259/