Thiago, take a look at this post http://ayende.com/Blog/archive/2009/08/16/what-is-the-cost-of-opening-a-session.aspx
On Wed, Oct 6, 2010 at 2:13 PM, Thiago Alves <[email protected]> wrote: > Jason, > > I do it as you suggested, but I have two questions: > > 1) Isn't it better to open the session only when needed for the first time? > It will reduce the session lifecycle and also avoid opening sessions when no > database access is needed. > > 2) Additionally, when you said " bind to current session context" did you > mean "bind to current request context", right? In other > words, HttpContext.Current.Items[], and not HttpContext.Current.Session[] > > Regards, > Thiago > > On Wed, Oct 6, 2010 at 1:51 PM, Jason Meckley <[email protected]>wrote: > >> build session factory when the application starts. >> store the factory as a singleton >> open session when request begins and bind to current session context >> before action start transaction >> within action use factory.GetCurrentSession() to access the current >> session >> after action commit/rollback transaction. >> unbind session from current context and dispose when request ends >> dispose of factory when application ends. >> >> you can manage the factory and session from global.asax. transactions >> can be placed in a filter. >> >> >> On Oct 6, 12:39 pm, Phil Whittaker <[email protected]> >> wrote: >> > Northwind.Core is a demonstration project using the Northwind Database. >> It >> > will show you how it all works. >> > >> > Phil >> > >> > On Wed, Oct 6, 2010 at 5:33 PM, dev2 <[email protected]> wrote: >> > > I am following your advice. >> > > When I go to the tutorial it tells me to go to Northwind.core.... >> > > So it seems like its missing something. I don't have anything to do >> > > with Northwind on my system (although I recognize Northwind as a >> > > sample database from somewhere). >> > >> > > Any suggestions? >> > >> > > On Oct 6, 12:16 pm, Phil Whittaker <[email protected]> >> > > wrote: >> > > > Hi >> > >> > > > If you are using ASP.net MVC I can't recommend Sharp Architecture >> enough. >> > >> > > > www.*sharparchitecture*.net/ >> > >> > > > It will give you a good start. >> > >> > > > Phil >> > >> > > > On Wed, Oct 6, 2010 at 5:03 PM, dev2 <[email protected]> >> wrote: >> > > > > Hi, >> > > > > I'm very new to this. I have searched around and I can't seem to >> find >> > > > > a concise guide to configuring an app to use NH. Can somebody >> advise >> > > > > or point me to a "known good" resource. >> > >> > > > > Thanks! >> > >> > > > > -- >> > > > > 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]> >> <nhusers%[email protected]<nhusers%[email protected]> >> > >> > > <nhusers%[email protected]<nhusers%[email protected]> >> <nhusers%[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]<nhusers%[email protected]> >> <nhusers%[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]<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]<nhusers%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/nhusers?hl=en. > -- ______________________________________ Felipe B. Oriani @felipeoriani <http://www.twitter.com/felipeoriani> | felipeoriani.com.br | [email protected] "...Trabalhe quanto puder, tornando-se útil quanto possível..." , por André Luiz -- 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.
