In this chapter, we will cover the following topics:
Setting up session per web request
Setting up session per presenter
Creating a session ASP.NET MVC action filter
Creating a transaction ASP.NET MVC action filter
Using the Conversation per Business Transaction pattern
Using session.Merge
Using session.Refresh
Using stateless sessions
Using dictionaries as entities
Using NHibernate with Transaction Scope
Introduction
NHibernate leaves session and transaction management up to the application. There are a number of different ways to manage sessions and transactions, and these depend greatly on the specific application architecture. In addition to a few interesting session methods, the recipes in this chapter show how to handle sessions and transactions for these different types of applications.