I have to display some objects which are stored in a relational database and I use fluent NHibernate to get them.
Since I need paging, I have to get both - the count of all objects, and the objects for the current page themselves.
The ICriteria for both purposes is very similar up to a point - for count i finally add .SetProjection(Projections.RowCount()) and for current object list I add SetFirstResult, AddOrder and SetMaxResults
Is there any way I could undo the projection on the criteria and reuse criteria for the results themselves, or do I have to reconstruct the criteria for that purpose?
hibernate forums suggests a way that does not work.