I have a c# library for my web application where I am using nhibernate.
The web application has the hibernate.cfg.xml file where I set:
current_session_context_class = web
I am using a nhibernateHelper class and a httpmodule to open and close the session on a per request basis.
I now need to use this library in a console application, what should I set the current_session_context_class value to be now?
There is a “thread” option that you can use. That will bind the current session to the thread.
For more on session management in desktop applications:
What is your session management strategy for NHibernate in desktop applications?
Ayendes MSDN article on NHibernate and desktop applications:
http://msdn.microsoft.com/en-us/magazine/ee819139.aspx