tags:

views:

59

answers:

1

Hi

When I invoke the SessionFactory.OpenSession() method a session is created, which contains a open connection to the database.

Sometimes I have the need to open a "lazy" session, meaning : I want a session to be created, but I do not want the connection to be opened yet. Only on the first query, or insert or update statement should the session connect to the db. Is this possible in nhibernate throught configuration or not?

Thanks

+1  A: 

Is far as I know when NHibernate session is created it doesn't open connection to the data base.

Sly
this is my understand as well, the session is more an implementation of the 'Unit of Work Pattern' and it will determine when to open the connection to the database not when the session is created.
AWC
I second that. Connection is only opened when NH needs to communicate with db, as far as I know.
epitka