在ASP.NET MVC3应用程序中,我的控制器将使用BL“管理”类的集合,而后者将使用存储库。这些存储库依靠EF DbContext实例来执行其职责。实例化存储库实例中的DbContext
我打算配置IoC容器做了依赖注入下面的方式(数据模块)
Bind<StoreContext>().ToSelf().InRequestScope();
Bind<ICatUserRepository>().To<GenericUserRepository>().InRequestScope();
StoreContext
是一个DbContext
。它是构造函数注入到GenericUserRepository
。 这种方式,我假设,the rule of my DbContext to be instantiated in also PerRequest将保持完成,对吧?