DDD - Consistency of Entity Across Bounded Context amp; Different Schemas in Database(DDD - 实体跨界上下文的一致性数据库中的不同模式)
问题描述
我首先使用实体框架代码实现 DDD.My Domain Model 保持不变,没有任何映射层.
I am implementing DDD with Entity Framework Code First. My Domain Model is persisted as it is without any mapping layer.
我遵循 Tech-Ed 期间建议的方法朱莉·勒曼.每个有界上下文映射到同一数据库中的不同模式.
I am following approach suggested during Tech-Ed by Julie Lerman. Each bounded context maps to different schema within same database.
如果同一个实体说,客户出现在不同的有界上下文中我们如何保持客户实体数据的一致性?
If same entity say, Customer appears across different bounded contexts how do we maintain consistency of data for Customer entity?
推荐答案
只有一个有界上下文将是 您的实体的记录系统.如果您无法仅在其他 BC 中使用 Id,则可以将实体的子集(通常不是所有属性)包含为值对象.
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.
对 SOR 中实体的任何更改都应作为下游 BC 订阅的消息传递系统中的一个或多个事件发布,以保持其数据最终一致.
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 - 实体跨界上下文的一致性数据库中的不同模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:DDD - 实体跨界上下文的一致性数据库中的不同模式


基础教程推荐
- 是否可以在 asp classic 和 asp.net 之间共享会话状态 2022-01-01
- 从 VS 2017 .NET Core 项目的发布目录中排除文件 2022-01-01
- 错误“此流不支持搜索操作"在 C# 中 2022-01-01
- 全局 ASAX - 获取服务器名称 2022-01-01
- 将事件 TextChanged 分配给表单中的所有文本框 2022-01-01
- JSON.NET 中基于属性的类型解析 2022-01-01
- 如何动态获取文本框中datagridview列的总和 2022-01-01
- 在 VS2010 中的 Post Build 事件中将 bin 文件复制到物 2022-01-01
- 首先创建代码,多对多,关联表中的附加字段 2022-01-01
- 经典 Asp 中的 ResolveUrl/Url.Content 等效项 2022-01-01