EF 6加上几个db上下文 [英] EF 6 plus several db contexts
问题描述
查看这个我倾向于不要使用几个dbcontexts。但是,看一些示例代码还是很好的。有人意识到使用几个dbcontexts和工作单元(和潜在的asp.net mvc)的企业级开源实现(c#)?
Looking at questions like this I am inclined not to use several dbcontexts. However, it would still be nice to have a look at some example code. Is anyone aware of an enterprise level open source implementation (c#) that uses several dbcontexts and unit of work (and potentially asp.net mvc)?
推荐答案
正如您使用企业一样,我会指出Julie Lerman,他从DDD有界语境的角度对多个DbContexts进行了很好的覆盖。
As you have used the word Enterprise I would point you at Julie Lerman, who has some nice coverage of multiple DbContexts from the perspective of DDD bounded contexts.
她是关于这个主题的相对较新的MSDN文章: http://msdn.microsoft.com/en-us/magazine/jj883952.aspx 。
Heres a relatively recent MSDN article she's written on this subject: http://msdn.microsoft.com/en-us/magazine/jj883952.aspx.
她还在Pluralsight上展示了一系列精彩的截屏,涵盖企业使用实体框架,包括使用多个上下文。我不会包括任何链接,因为这是一个付费服务。
She also has a fantastic series of screencasts on Pluralsight that cover enterprise use of Entity Framework, including the use of multiple contexts. I wont include any links as this is a paid-for service.
从代码示例的角度来看,参考CQRS架构在Microsoft Patterns&使用有限上下文(作为多个DbContexts)将复杂系统分解为单独的域的实践。 http://msdn.microsoft.com/en-us/library/jj554200.aspx
From a code sample perspective, take a look at the reference CQRS architecture on the Microsoft Patterns & Practices which uses bounded contexts (as multiple DbContexts) to decompose a complex system into separate domains. http://msdn.microsoft.com/en-us/library/jj554200.aspx
参考CQRS架构的代码在这里: https://github.com/mspnp/cqrs-journey-code 。
The code for the reference CQRS architecture is here: https://github.com/mspnp/cqrs-journey-code.
希望一些这证明对你有用。
Hope some of this proves useful to you.
这篇关于EF 6加上几个db上下文的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!