The code is correct. The problem is the workflow. I will try to explain how
the things work in my web application.
1) I have a singleton class *SessionFactoryProvider *which reads nhibernate
configuration and builds a session factory (SF). When the SF is built I put
it in a field so *SessionFactoryProvider *can return it for later use.
2) When the application starts (global.asax/Application_Start) the
*SessionFactoryProvider
*builds SF and stores it in the HttpApplication[somekey].
3) For session management I use HttpModule to open ISession and close
session at Begin/End request.
- Get the *SessionFactoryProvider *from HttpApplication[somekey];
- Get the current SF
- SF.OpenSession
4) On Application_End the SF is closed.
So far so good. This workflow will always work if 2 and 4 are always called.
Here is the tricky part. When I start debugging I can click Stop which will
cause to skipp step 4. ResetIIS and start the application again will try to
create a new SessionFactory but the previous one is not closed.
Q1) Does nhibernate stores somewhere an information statically about the
active SFs?
Q2) Is there any way to get all Active SFs or kill them?
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/nhusers/-/Qe2iPuMDtWsJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en.