sergey wrote:
Well if you don't need the objects themselves, then you don't really need NHibernate. Just get the connection from a session and execute your command directly.
This is possible in theory, but is becoming a really bad idea in practice.
It's clearly a shortcut in terms of development practices and I don't want to encourage using the SQL connection directly since the entire application standardizes on NH. We do COUNT elsewhere in an NH query. Also, the connection object is not accessible in the context on purpose, so I don't want to abandon that easily :)
In addition, I am hoping that one day NHibernate can, for example, do a great job caching objects returned from a FREETEXT query. Then I'll ask NH the count instead of SQL.
So is this impossible right now?
Much appreciated,
dB.