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().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 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.