NH ProfA guided tour

time to read 4 min | 704 words

NH Prof has reached the level in which I can actually talk about the features that it has in more than abstract terms. There is still a big feature area that I want to cover (which should be a nice surprise), but the basics are there, and today I had ample proof that it is maturing just nicely. I was able to deal with quite a few of the remaining tasks by applying check listing. Basically, to do X, I had to do A,B & C. Trivially simple, and quite satisfying.

Test coverage went back up to over 90% on the backend again, which is also nice.

Anyway, let us start with the tour, shall we?


The left upper pane shows the captured sessions. You can see the number of statements per each session, as well as the length time it was open.  Let us move down a bit, and explore statistics.


The session factory statistics pane include a lot of information about NHibernate, which can give you a good indication about what is going on in the application in a global fashion. In 2.0 we have quite a few data points, but the statistics feature was significantly expanded in 2.1, and contains a lot more data and more finely grained statistics.

But that is probably not what gets you excited. What is likely to thrill you are the statement view.


I put a lot of though into designing those (well, into thinking about them, the actual design was handled by people who actually know what they are doing, design wise). The upper section of the screen is optimized to allow the human eye to quickly scan it in order to find all sorts of interesting patterns. Compare this to SQL Profiler UI, and you can see why I think that this is a much better version, just from that stand point.

The bottom half, however, is what I really like. This is the part I use the most often, in order to really see what is going on. I did an ad-hoc demo of the profiler in Dallas, and one of the things that cam out of this was the format that you see on the lower pane. This UI is set to allow you to just copy the query from the profiler and immediately execute a readable, easy to understand query on Management Studio or Toad. Again, another piece where I think that I providing a lot more value than SQL Profiler does.

For quick reference, we put the parameter values on the left of the query, so you can inspect them without having to go into a potentially complex queries to try to figure out what is what.

But this isn't where it ends, let us take a look at the stack trace tab:


The stack trace will let you correlate a query and the code that generated it, and not only that, it will take you directly from the query to the code (opening visual studio, loading the file and landing you directly in the place in the code that caused this query to be executed.

Oh, and one more thing...


I have over four years of experience working with NHibernate, a time during which I learned quite a bit about what work, what doesn't and what kind of things we should be aware off. The profiler has given me the chance to codify a lot of these patterns, and put them in a way that allow you to have apply early detection and prevention mechanisms.

And one last thing, this time it will really be the last. Session / Entity inspection:


You can see exactly what are the entities that were loaded by this session, including counts per entity and all the ids that were loaded.

I hope to be able to open it for beta testing in two to three weeks, and a 1.0 release about a month after that. Pricing is tentatively set at 200$ per user, but this is subject to change.

More posts in "NH Prof" series:

  1. (09 Dec 2010) Alert on bad ‘like’ query
  2. (10 Dec 2009) Filter static files
  3. (16 Nov 2009) Exporting Reports
  4. (08 Oct 2009) NHibernate Search Integration
  5. (19 Aug 2009) Multiple Session Factory Support
  6. (07 Aug 2009) Diffing Sessions
  7. (06 Aug 2009) Capturing DDL
  8. (05 Aug 2009) Detect Cross Thread Session Usage
  9. (22 May 2009) Detecting 2nd cache collection loads
  10. (15 May 2009) Error Detection
  11. (12 May 2009) Queries by Url
  12. (04 Feb 2009) View Query Results
  13. (18 Jan 2009) Superfluous <many-to-one> update
  14. (18 Jan 2009) URL tracking
  15. (10 Jan 2009) Detecting distributed transactions (System.Transactions)
  16. (06 Jan 2009) The Query Cache
  17. (05 Jan 2009) Query Duration
  18. (24 Dec 2008) Unbounded result sets
  19. (24 Dec 2008) Row Counts