We have learned that entity state in the memory is synchronized to the database either when session is flushed or transaction is committed. All the calls we made to ISession.Save
or ISession.Update
till that point do not send any changes to the database. Instead, what they do is create an event and push it into the events array maintained by the session. When the session is flushed (explicitly or via committing the transaction), then NHibernate goes through each of the events and executes them one by one. As usual, I am making it easy by giving you a 10,000 feet view of how events work. Exact working of the events is more complex in reality. Intent of this section is not to understand how the events work internally. This section is more about how to listen to NHibernate's internal events and how to be notified so that we can execute our own code in response to a particular action that NHibernate carries out internally. Event listener is the mechanism that we would use for this...
Learning NHibernate 4
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
Free Chapter
Introduction to NHibernate
Let's Build a Simple Application
Let's Tell NHibernate About Our Database
NHibernate Warm-up
Let's Store Some Data into the Database
Let's Retrieve Some Data from the Database
Optimizing the Data Access Layer
Using NHibernate in a Real-world Application
Advanced Data Access Patterns
Working with Legacy Database
A Whirlwind Tour of Other NHibernate Features
Index
Customer Reviews