What is the best way to instantiate and dispose DbContext in MVC?
MVC 3 + EF 4.1 I'm choosing between two approaches to deal with DbContext: Instantiate in Application_BeginRequest , put it into HttpContext.Current.Items and dispose in Application_EndRequest . Create disposable UnitOfWork (kindof wrapper for DbContext ) and start each controller action with using(var unitOfWork = new UnitOfWork()) { ... } Share your experience please: Which one would you prefer? what are pros and cons for each approach? I would suggest you use a Dependency Injection framework. You can register your DbContext as per request container.RegisterType<MyDbContext>()