I have been using Ninject IoC container in my ASP.NET MVC3 portal. Whenever I've been injecting Entity Framework DbContext
in PerThread
scope, my data wasn't consistent, changes would not get displayd for some time after I've made changes to Entities, etc.
After I've switched the IoC configuration to resolve a fresh copy of my DbContext
instance for each request (PerRequestScope()
), all the problems were gone.
So is it absolutely mandatory to use PerRequest injection strategy in MVC3 applications?