I'm doing a little bit of NHibernate usage tweaking in my ASPNET MVC
and I noticed every time I goto a server page it's opening a
connection/session. The issue is I want to tell NHibernate to open a
connection/session on demand (where there are queries) in my
implemented System.Web.IHttpModule class (using BeginRequest and
EndRequest)? How?

My code snippet:
private static void OnBeginRequest(Object sender, EventArgs e) {
        NHibernate.ISession ormSession = GetSessionFactory
().OpenSession();
        NHibernate.Context.CurrentSessionContext.Bind(ormSession);
}

Thank you for your help,
William Chang
http://www.williamchang.org
-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
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.


Reply via email to