Chapter 8. Using NHibernate in a Real-world Application
We have learned a lot of concepts and features of NHibernate. But we have learned all of them in isolation so far. While I enjoyed talking about them, it would be more interesting to see how to actually make use of NHibernate capabilities in a real-life application. And that is what I intend to do in this chapter.
There are two main objectives of this chapter. First one is to understand how NHibernate-based data access layer fits into the overall architecture of a web application and how it interacts with other components of an architecture. Second objective is to look closely at concepts such as repository pattern, unit of work, and session context. Repository pattern is a very commonly used pattern for abstracting away complex data access concepts and making the working with ORMs such as NHibernate easy. Unit of work is another time tested concept around executing related work items together as a unit. Session context is something...