I am using an older version of nHibernate due to my old version of .net. QueryOver isn't an option. What's an efficient way to count the rows of a table with nhibernate?
1 Answer
The HQL you show in your comment is correct:
int count = (int)s.CreateQuery("select count(*) from [classname]").UniqueResult();
This will return the number of rows in the table represented by classname.
1 Comment
Gizmo
s.CreateSQLQuery("select count(*) from [classname]") .UniqueResult<Int32>(); this one did it. I don't know why the other one wouldn't work. Thank you anyways.