I need some tips on NHibernate session management for a C # WinForms application.
I am currently porting the application to use NHibernate. I also use the UnitOfWork pattern as described in the link below;
http://nhforge.org/wikis/patternsandpractices/nhibernate-and-the-unit-of-work-pattern.aspx
My question is about sessions.
Can you have only one session running in a thread?
I have a scenario in which a session (UnitOfWork) can be opened for the form shown by the application, but the user opens another form (e.g. Tools - Options) that I would like to have my own UnitOfWork. Obviously, in this case it would be more reasonable to open another session for the "Tools - Options" form, and not use the current open session for the base form.
Can we have a dictionary of sessions in one thread?
Any recommendations for managing sessions are welcome.
c # session winforms nhibernate
Hugusta
source share