Getting started

Using the NHibernate Profiler is easy. First, we need to make the application that we profile aware of the profiler. Then, just start the profiler.

Preparing an application to be profiled

Add a reference to the HibernatingRhinos.Profiler.Appender.dll assembly, located in the downloadable zip. In the application startup (Application_Start in web applications, Program.Main in Windows / console applications, or the App constructor for WPF applications), make the following call:

HibernatingRhinos.Profiler.Appender.NHibernate.NHibernateProfiler.Initialize();

Getting NHibernate statistics

If you want to view the NHibernate internal statistics, you need to modify your NHibernate configuration and set generate_statistics to true. This is how you do it using the standard NHibernate configuration mechanism:

<property name="generate_statistics">true</property>

This isn't the only way to profile an application; you can also configure your application to work with the profiler without changing any code.