I need to do the following for the purposes of paging a query in nHibernate:
Select count(*) from (Select e.ID,e.Name from Object as e where...)
var session = GetSession(); var criteria = session.CreateCriteria(typeof(Order)) .Add(Restrictions.Eq("Product", product)) .SetProjection(Projections.CountDistinct("Price")); return (int) criteria.UniqueResult();