Saturday September 24th

Friday September 23rd

Thursday September 22nd

NHibernate Session-Per-Method-Call via StructureMap Nested Containers

There are several documented approaches you can follow to implement the session-per-method-call pattern with NHibernate and StructureMap. The majority of these approaches fail to leverage the full capabilities of StrurctureMap and are therefore more complex than they need to be. In this short post, I’ll show you how you can implement a simpler solution by utilizing StructureMap’s nested containers.


This is a pretty sweet solution, have you considered coming up with a way to package this as a sort of contrib project to NH? The ability to drop something like this into a project via Nuget is just too tantalizing.

I hadn't thought about that, but now that you mention it, this would be something that could be packaged up fairly easily. I'd have to do a bit of digging about how to hook the behavior in using a NuGet package, but I know it's doable.

Commenting on Stories is limited for now and will open up to those recommended by the community. Learn how
Loading DotNetKicks...
brought to you by the Kicks Network