Summary
This chapter has covered some of the most powerful features of NHibernate that we may not need to use on daily basis.
We started the chapter with concurrency control. Concurrency control is very critical from a business point of view as it helps with preventing corruption of data due to multiple writes to the same data at the same time. NHibernate mainly provides two ways of concurrency control.
Optimistic concurrency control is a database technology agnostic. This is built entirely within NHibernate and you can use it with any database. Pessimistic concurrency control, on the other hand, makes use of database locks to make sure that only one transaction can update a database record at any point of time. Event system of NHibernate is carefully designed to make sure that enough extension points are provided for the users of NHibernate to plug in their own code at multiple different times during the commit of a transaction. What you can do with these hooks is only limited by your creativity...