ActionFilter is much cleaner, but here's an alternative: http://jasondentler.com/blog/2009/08/part-7-nhibernate-and-ninject-for-asp-net-mvc/
On Wed, Jan 6, 2010 at 4:33 PM, Fabio Maulo <[email protected]> wrote: > ActionFilter instead HttpModule to manage session-per-request > > 2010/1/6 William Chang <[email protected]> > >> 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]<nhusers%[email protected]> >> . >> For more options, visit this group at >> http://groups.google.com/group/nhusers?hl=en. >> >> >> >> > > > -- > Fabio Maulo > > > -- > 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]<nhusers%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/nhusers?hl=en. > >--
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.
