简体   繁体   English

实体框架,绑定上下文和DDD

[英]Entity Framework, Bound Context and DDD

I am trying to create bounded context using EF and a edmx file. 我正在尝试使用EF和edmx文件创建有界上下文。 At the beginning all entities are in the same edmx file and then I split the model in another project and I change the Dbset and I use IDbSets instead. 最初,所有实体都在同一个edmx文件中,然后将模型拆分到另一个项目中,然后更改Dbset,而改用IDbSets。 I created other edmx file and I am trying to use a table/tables that are in the other edmx. 我创建了另一个edmx文件,并且尝试使用另一个edmx中的一个表。 Of course when I run the custom tool (right click on the edmx file, run custom tool) the tt file removes the table/Idbset from one place to another. 当然,当我运行自定义工具时(右键单击edmx文件,运行自定义工具),tt文件会将表/ Idbset从一个位置移到另一个位置。 What do you guys do? 你们做什么? How about if you need a context with few tables and you do not want some tables that are related to the one that you add to that context. 如果您需要一个只有几张表的上下文,而又不想有一些与您添加到该上下文的表相关的表,那该怎么办? Hopefully someone understand my question? 希望有人能理解我的问题?

Can you create multiple edmx(s) with only the tables you need? 您可以仅使用所需的表来创建多个edmx吗? For example ABC.edmx have three tables A, B & C. The three entities that you generate through T4 belong to a bounded context ABC. 例如,ABC.edmx具有三个表A,B和C。您通过T4生成的三个实体属于有界上下文ABC。 You can create another DEF.edmx having the tables D,E & F. The entities D,E & F belong to the bounded context DEF. 您可以创建另一个具有表D,E和F的DEF.edmx。实体D,E和F属于有界上下文DEF。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM