ObjectContext never derives from an interface?? How do you apply DI/IoC in case of multiple types of ObjectContext?

前端 未结 2 1781
北恋
北恋 2021-01-07 07:32

If you have a system that has multiple types of object contexts. For Eg: BillingObjectContext, HumanResourceObjectContext etc. All derive from ObjectContext but ObjectContex

2条回答
  •  借酒劲吻你
    2021-01-07 07:35

    If you must depend on it in a test, you have to mock it. Here's a sample; it's not much harder than implementing an interface. See also TDD improvements in EF 4.

提交回复
热议问题