O'Reilly logo

NHibernate 3.0 Cookbook by Jason Dentler

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Setting up session per presenter

In desktop applications using the model-view-presenter pattern, it's best to use a session for each presenter. This approach can also be adapted to the model-view-view model pattern. More information on these patterns is available at http://en.wikipedia.org/wiki/Model-view-presenter.

In this recipe, I'll show you how to implement this session-per-presenter pattern with dependency injection.

Getting ready

You'll need the named scope extension to Ninject available at http://github.com/remogloor/ninject.extensions.namedscope.

Download the source code in ZIP format and extract it. Open the Ninject.Extensions.NamedScope.sln solution in Visual Studio and build the solution. Copy Ninject.dll and Ninject.Extensions.NamedScope.dll ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required