Book Image

Learning NHibernate 4

Book Image

Learning NHibernate 4

Overview of this book

Table of Contents (18 chapters)
Learning NHibernate 4
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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 that they are carried out atomically – either all operations succeed or all operations fail. Atomicity of database operations results in consistent state of data which is very important from functional point of view.

The last topic we covered was repository...