Currently I have a method with:
Code:
ISession session = _sessionManager.OpenSession();
ISession innerSession = ((SessionDelegate)session).InnerSession;
queryObject.SetProjection(Projections.RowCount());
ICriteria criteria = queryObject.GetExecutableCriteria(innerSession);
criteria.SetFirstResult(0);
int rowCount = (int)criteria.UniqueResult();
queryObject.SetProjection(null);
queryObject.SetResultTransformer(CriteriaUtil.RootEntity);
return rowCount;
The problem is if I have an order by in my criteria query, I get the error the property isn't contained in an aggregate.
Is there any way to strip the order by from the criteria query temporarily for the operation? Perhaps when the query sees the rowcount projection?