Creating a Glimpse plugin to log SQL generated by NHibernate
July 29th, 2011 by Kurt Schindler
Glimpse has generated a lot of buzz since it was unveiled earlier this year during the “Open Source Fest” at the Mix 2011 conference. If you’re not already using it to debug your ASP.NET Web Forms or MVC application, you should be. Glimpse allows you to inspect several server-side diagnostic and request related information with a UI just like Firebug. Here’s some resources to get you started if you need an intro:
There are several built-in plugins for Web Forms and MVC that will serve many needs, and you can even create your own. This tutorial will demonstrate how to create a plugin that will display the SQL generated by NHibernate.
Glimpse Plugins
Plugins are implemented by a simple class that implements the IGlimpsePlugin interface. There are a couple of great “hello world” example plugins on the Glimpse creating plugins page. Besides setting the name and some optional start-up code, a plugin’s main job is just to return some set of data that will be rendered to the Glimpse UI. What that data is and how we get it is the real magic, so read on below. Read the rest of this entry »