Get list of named queries in NHibernate
- by Dan
I have a dozen or so named queries in my NHibernate project and I want to execute them against a test database in unit tests to make sure the syntax still matches the changing domain/database model. Currently I have a unit test for each named query where I get and execute the query, for example:
IQuery query = session.GetNamedQuery("GetPersonSummaries");
var personSummaryArray = query.List();
Assert.That(personSummaryArray, Is.Not.Null);
This works fine, but I would like to have one unit test that loops thru all of the named queries and executes them. Is there a way to discover all of the available named queries?
Thanks
Dan