How can I map this SQL using NHibernate Criteria API?
Sql:
SELECT COUNT(*) FROM (
SELECT FirstName, LastName FROM Employees GROUP BY FirstName, LastName
) AS Query
This is a very very simple query, my query has a SubSelect much more complex.
So, any idea?
I found a solution for the question, it’s a very big hack but it works as expected.
I had to get the generated SQL and surround it with the SELECT COUNT(*) query. Here is the code to do that: