From the docs:
Quote:
11.13. Tips & Tricks
You can count the number of query results without actually returning them:
Code:
IEnumerator countEn = session.Enumerable("select count(*) from ....").GetEnumerator();
countEn.MoveNext();
int count = (int) countEn.Current;
Other than looking like a workaround, this uses obsolete code (session.Enumerable); it might be better to change it to:
Code:
int count = (int) session.CreateQuery("select count(*) from ...").UniqueResult();
Update: jira seems to be back online now, so I created an issue for this:
http://jira.nhibernate.org/browse/NH-780