EF Context Management

What is the best way to manage the context of Entity Framework when using MVC application?

I am using a Repository/Service pattern.

Edit

After looking through some of these questions: stackoverflow.com/users/587920/sam-striano, I am more confused then before. Some say use the context per repository, but wht if I want to use multiple repositories in one controller method?

And to follow good separation design, how do you use UnitOfWork in the MVC app with out making it dependent on EF? I want to be able to unit test my controllers, model, services, etc. using a mock context?

7
задан Brian Tompsett - 汤莱恩 11 June 2015 в 18:30
поделиться