Ok, found the problem. The problem was in StructureMap conviguration for this class: I had: ForSingletonOf<IClass>().Use<Class>();
Now changed to: For<IClass>().Use<Class>(); On Nov 19, 2:56 pm, Luka <[email protected]> wrote: > And this only happens if I let StructureMap instantiate the class, > but if I uset ObjectFactory.GetInstance<T>() then it works ok. > > On Nov 19, 2:25 pm, Luka <[email protected]> wrote: > > > > > > > > > And this happens only in one class, the same repository works in > > another one. > > > On Nov 19, 12:04 pm, Luka <[email protected]> wrote: > > > > Hi, > > > I have a problem. > > > I've setup ma session management as per wcf call. > > > I am using StructureMap as IoC and I am injecting the session to the > > > repository constructor. > > > > there is one scenario when I am getting Session is closed exception. > > > So I debug and this is the workflow: > > > 1. SessionFactory.OpenSession() > > > 2. Save Session in context > > > 3. StructureMap gets the session from context > > > (For<ISession>().Use<_sessionFactory.GetCurrentSession()), and inject > > > the session into my repository (at this moment Session.IsOpen == true) > > > 4. I am doing some query. > > > 5. On query execute (the exception Session Is closed is thrown) > > > 6. WchCall ends > > > 7. The Detach(InstanceContext) from > > > NHibernateContextManager:IExtension<InstanceContext> is called (at > > > this momment Session.IsOpen == true!!!!) > > > 8. Session.Close is called > > > > This exception happens only in one scenario, everything else is > > > working ok. > > > > Please help. -- 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.
