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 the dependency injection or Inversion of Control concepts, a free video tutorial is available at http://tinyurl.com/iocvideo.
Note
This recipe can be completed with other dependency injection frameworks. Just substitute the NinjectBindings
class with...