Summary

We tried to bring a change in general style and tone of this chapter. I hope you felt it. This chapter was more about practical guidance and I felt I would make it sound more like so. Along with practical guidance and design principles, there were three main topics that we covered in this chapter. First and most important is contextual sessions. Contextual sessions can be used to effectively manage and reuse session object across multiple classes. If you are not using IoC containers, then session context is probably the best way to implement strategies such as "session per request", and so on. Next we talked about unit of work, another important concept. Unit of work lets you bundle different database operations under a transaction so ...

Get Learning NHibernate 4 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.