本文介绍了DDD - 跨边界实体的一致性数据库中的不同模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在实施具有实体框架代码的DDD。我的域模型是持久存在的,因为它没有任何映射层。



我在 by Julie Lerman。每个有界的上下文都映射到同一个数据库中的不同模式。


解决方案

只有一个有限的上下文将是为您的实体。如果您不能在其他BC中简单地找到一个Id,那么您可以将实体的一个子集(通常不是所有的属性)作为值对象。



任何在SOR中对实体的更改应当作为下游BC订阅的消息传递系统中的一个或多个事件发布,以便使其数据最终保持一致。


I am implementing DDD with Entity Framework Code First. My Domain Model is persisted as it is without any mapping layer.

I am following approach suggested during Tech-Ed by Julie Lerman. Each bounded context maps to different schema within same database.

解决方案

Only a single bounded context will be the system of record for your entity. If you cannot get away with simply an Id in the other BCs then you can include a subset of the entity (usually not all the properties) as a value object.

Any changes to the entity in the SOR should be published as one or more events in a messaging system that the downstream BCs subscribe to in order to keep their data eventually consistent.

这篇关于DDD - 跨边界实体的一致性数据库中的不同模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-12 19:29