Hi,
I am new to use nhibernate.
I have try to find with search on forum and with some google help but nothing so you are my last chance.
I try to just make a count on a table.
for that i do not want to load all table and make count after.
I need to have optimise thing...
I have try :
Code:
public int GetObjectCount(Type objectType)
{
session = factory.OpenSession();
session.BeginTransaction();
return (int) session.CreateQuery("select count(*) from "+objectType.ToString()).UniqueResult();
}
I have finnaly done that but it is not object oriented.
So I am sure it is possible to set table (FROM) with createcriteria and after filter what we want (SELECT) with a function to say what i want is count(*) but I have not found.
thanks by advance for any answer.