This project is read-only.

Singleton pattern web app

Aug 17, 2010 at 3:39 AM

I've been probing others ORM Framworks like Ibatis and NHibernate. I found that these frameworks have a session object, that is like a singleton per user session wrapper class for ObjectContext and Storage OPF3 objects.

Since I looked that, I've been wondering if is a good idea create just one objectcontext and storage per user session in a web application, storing these objects in session. 

Best regards.

Aug 19, 2010 at 7:52 PM
Hi. You can do that and store the context in the session of the user. But make sure that each individual context is only accessed from one thread in that session. The ObjectContext is not multi-threading safe.