I have a bunch of queries to run, and if any of them return even a single result, I toggle a boolean variable true. If they all return no results, then it stays false.
Right now I'm just picking the smallest column and .Select() ing it, and then counting the results locally. But is there a way to have the database send back a single integer representing the record count of the query through linq-to-nhibernate?
Thanks!
Using the Query API, it would be
return Session.QueryOver<YourType>().RowCount();
or for Int64
(bigint
)
return Session.QueryOver<YourType>().RowCountInt64();
If you're sending multiple queries, then you could use futures to batch all the queries together.