MvcMiniProfiler and NHibernate: Take 2 - Batching support

[UPDATE: Thanks to Sam for the comment - data reader now intercepted and wrapped, gist updated]

My previous solution for getting NHibernate working with MvcMiniProfiler had one problem, it didn't work with batching.

RealProxy was mentioned as a possible solution in the issues forum - see http://code.google.com/p/mvc-mini-profiler/issues/detail?id=29&can=1

The following code should be viewed as experimental, I have never used RealProxy before and I may be doing something really dumb here - however this is working well in my application and profiling now works with batching.

The solution is similar to before, I'm creating a new NHibernate client driver. However this time I'm not using any of the existing profiled wrapper classes. I'm creating a transparent proxy for SqlCommand, intercepting calls to ExecuteNonQuery/ExecuteReader/ExecuteScalar and making calls to the IDbProfiler.

Here's the gist, comments appreciated -

About