Often, a unit of work maps neatly on to a single controller action. I'll show you how to create an action filter to manage our NHibernate sessions in an ASP.NET MVC application.
Setup an ASP.NET MVC application for NHibernate. The steps are as follows:
log4net.dll, and our
Eg.Coreproject from Chapter 1.
web.configfile, set up the NHibernate and log4net configuration sections. Refer to the Configuring NHibernate with App.config recipes in Chapter 2.
Global.asax, create a static property named
public static ISessionFactory ...