Chapter 3. Sessions and Transactions
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
- Save entities to the database
- Using session.Merge
- Using session.Refresh
- Handle concurrency using session.Lock
- 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 they 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 ...
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.