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

Configuration options


During code examples so far, we have seen various configuration options or properties such as dialect, driver, connection provider, and so on being set. In this section, we will try to know more about what these options mean, what are the different possible values that these options take, and what do we get out of these options. NHibernate has several such options available. In this section, we are going to look at some of the important and commonly used ones.

Connection release mode

One of the things we learned in the previous chapters about session is that it opens an ADO.NET connection to the database when it needs to connect to database for the first time. But when is this connection closed? That is what connection release mode defines. There are two connection release modes, described as follows:

  • OnClose: This is a legacy of the first version of NHibernate where an ADO.NET connection acquired by a session was closed when the session was closed or disposed

  • AfterTransaction...