That's not what I meant. Many sources recommend using the "web" NHibernate session context (NHibernate.Context.CurrentSessionContext) for an ASP.NETapplication, which ties a session to an HTTP request lifecycle (I'm not suggesting or condoning sharing NH sessions across requests via ASP.NETsessions)
My question was - are you suggesting that an NH session is intrinsically a single unit of work? Because if you use the above context (wherein the NHibernate.Context.CurrentSessionContext will always return the same NH session for a single HTTP request) would imply otherwise, either that or you expect a single HTTP request to conduct only one unit of work Alex Norcliffe Lead Architect, Umbraco 5 ASPInsider Microsoft Regional Director @alex_norcliffe <http://twitter.com/alex_norcliffe> on Twitter, blogging at boxbinary.com * * On 29 April 2012 20:25, Ramon Smits <[email protected]> wrote: > > > On Sun, Apr 29, 2012 at 8:47 PM, Alex Norcliffe < > [email protected]> wrote: > >> @Ramon - Are you suggesting that the OP should have one session per unit >> of work? Do you have any documentation to support this recommendation? It >> goes contrary to the session context one might use in a web environment, >> for example. > > > I don't understand your question. An asp.net session is something totally > different then an nhibernate session. An asp.net session makes it > possible to share certain state for a specific browser session at the > server between requests. > > An nhibernate session should definitely not be stored in an asp.netsession! > Well, maybe there is the ability to disconnect a session at the > end of a request and reconnect it at the start of a request but this would > be bad practise I guess. > > NHibernate sessions should have a short life span in web applications. > > Ramon > > -- > 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. > -- 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.
