Ayende @ Rahien

It's a girl

NH Prof: Configuration Story

Icon I think that I mentioned that NHibernate Profiler is working mostly by doing some smarts on top of the log output from NHibernate. That is not exactly the case, but that is close enough. The problem with working through the logs is that there are roughly 30 lines of XML that you need to deal with in order to manage this properly.

The first time I sent this to anyone else, he run into problems with the configuration because of very subtle issues. For a while now, I had a ticket saying that I need to document what the failure scenarios are, and how to deal with them.

Today, as I sat down to deal with this ticket, I decided that it is wrong to even try. This is shoving my own problems to my users. I shouldn't do that, if the configuration is hard to do, that is my own issue, and not theirs. I should bear the burden of complexity.

As such, I spent some additional time getting this to work in the smoothest way possible. The end result is that in order to use NHibernate Profiler in your application, all you need to do is add the following line at the application startup (Main, Application_Start, etc).

NHibernateProfiler.Initialize();

That is it :-)

Comments

jdn
11/26/2008 12:48 AM by
jdn

Is there a possibility in the future of having something like 'attach to process' a la Visual Studio, so that you can use the profiler without having to change code?

Ayende Rahien
11/26/2008 01:58 AM by
Ayende Rahien

jdn,

Yes, you could. It is a bit problematic, but in general, you can just set the configuration in the web.config, and be done with it.

At least, I think you can. You probably need to call the log4net initalizer anyway.

Ryan Kelley
11/26/2008 03:54 AM by
Ryan Kelley

Looks like you are making really good progress, can't wait to see a finished product or beta. Keep it up, we all appreciate it.

Maz
11/26/2008 08:53 AM by
Maz

Seems to difficult, can i have the documentation please

Rasmus Kromann-Larsen
11/28/2008 08:36 AM by
Rasmus Kromann-Larsen

@Serhat - Well, it might be true for many components that this kind of initialization is bad - but none of your code should depend on NHProf anyways :-)

Comments have been closed on this topic.