Setting up session-per-presenter

It's a good idea to use a session for each presenter in desktop applications using the Model View Presenter (MVP) pattern. This approach can also be adapted to the Model View View Model (MVVM) pattern. More information on these patterns is available at http://en.wikipedia.org/wiki/Model–view–presenter and http://en.wikipedia.org/wiki/Model–view–viewmodel.

In this recipe, we'll show you a crude implementation of this session-per-presenter pattern with dependency injection. While MVP and MVVM are more common in Windows Forms and WPF applications, we will just create a simple console application this time.

We will use an inversion of the control container, called Ninject, in this recipe. If you're not familiar with ...

Get NHibernate 4.x Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.