Sunday, December 13, 2009

Nhibernate Profiler – not displaying all statements? – Solution

Yesterday I made some integrationtests with nhibernate and NUnit. Suddenly I could not see all statements in the NHibernate Profiler, but sql statements was displayed in Visual Studio. A quick post to the NH Profiler support at google groups gave me the solution.

If the process that runs the query via NHibernate terminates too quickly not all statements will show up in the NHProfiler, but if you make the following call at the end:

   1: ProfilerInfrastructure.FlushAllMessages();

All statements will show up. For a test with NUnit as I had, I just placed the call in a TearDown method for the TestFixture, and vola now all statements are showed in the NHibernate Profiler.

No comments: