Thanks for your help guys! After looking around a while, I found that you define the session context class via a config parameter: current_session_context_class. In my nhibernate.config class, I had it set to "web" - Most likely due to a copy/paste situation. Changing the value to "call" makes everything work as expected and eliminates the check for HttpContext. Also, Jason thanks for the tip about using CurrentSessionContext, I've changed my code to use that instead of ThreadLocalSessionContext.
Jim On Apr 3, 7:00 am, Jason Dentler <[email protected]> wrote: > Good catch Fabio. > > While it won't fix your problem (because you are apparently using web > contextual sessions in a non-web app), why don't you use > CurrentSessionContext to bind and unbind instead of the very specific > ThreadLocalSessionContext? > > > > On Sat, Apr 3, 2010 at 12:16 AM, Fabio Maulo <[email protected]> wrote: > > > 2010/4/2 Jim Geurts <[email protected]> > > >> I'm using NHibernate 3.0.0.4967 with StructureMap. I don't think that > >> StructureMap is causing the troubles, but I could be wrong. > >> StructureMap stores the ISession object on the local thread (I > >> use .HybridHttpOrThreadLocalScoped() to do so). Other than storing > >> the session in ThreadLocalSessionContext in my base class constructor, > >> do I have to explicitly tell NH not to look for HttpContext by some > >> other means? > > >> Resuming: > > You think that the cause is not StructureMap and you are sending a mail > > here with the stack-trace because you think that the problem is within NH... > > But in this story there are 3 subjects. > > Why you are discarding your self as a possible cause ? > > > Have a look to the first line of the stack-trace > > NHibernate.Context.WebSessionContext.GetMap() > > Do you have HttpContext.Current in your test ? > > -- > > 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.
