How initial startup for NHibernate Profiler
Asked Answered
F

1

8

I have a Wpf application using Nhibernate. I want to see details of sent query to database by NHibernate Profiler. For initial startup, what should I do?

Feldman answered 5/11, 2011 at 13:13 Comment(0)
V
12

There are multiple ways of integrating nhibernate profiler into your application. One way is to use the custom nhibernate profiler log4net appender. You can find out how to use this way here:

http://nhprof.com/Learn/Usage/ProfileAppWithConfiguration

Another way to do this is to include HibernatingRhinos.Profiler.Appender.v4.0.dll into your project and include the following code somewhere at startup (I usually include this in my SessionFactory helper class that initializes my SessionFactory and hands out ISessions):

//Using statement needed for the statement below
using HibernatingRhinos.Profiler.Appender.NHibernate;

//Initialize so that we can use NHibernate Profiler (http://nhprof.com/)
NHibernateProfiler.Initialize();

Also if you want to view nhibernate statistics from within nhibernate profiler you need to include the following in your nhibernate configuration section:

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

All of this information can be found here: http://nhprof.com/

Versieversification answered 5/11, 2011 at 14:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.