As a rule, I would go for an implementation where the complexity of working with EF is abstracted using the Repository template, but the context is alive as long as I need it. (Scenario 3)
By βas long as I need it,β I mean while the service call is being executed. I do not want the ObjectContext persist through multiple service calls, as I would have to deal with its state. The cost of creating a new ObjectContext negligible.
I think that in many ways your ModelAdapter also abstracts the complexities of EF, however, based on its static nature, you may / may run into problems in parallel scripts if you decide to keep the ObjectContext . The way it is currently implemented may not give you the flexibility you need for more complex queries (for example, for the Order β OrderDetail β Product connection).
source share