我有以下型号:最佳实践
public class Team {
public Guid Id {get; set;}
public string Name {get; set;}
public string League {get; get;}
public int Rating {get; set;}
}
在创建新的团队在系统中,我发布事件:TeamCreated
到服务总线:
{
"MessageId": "33909eaf-56a1-4467-a01a-64b94f10490c"
"MessageType": "TeamCreated",
"CreationDate": "20-01-2016",
"Payload": {
"Id": "11111www-56a1-4467-a01a-64b94f000111",
"Name": "Toronto Maple Leafs",
"League": "NHL NorthEast",
"Rating": 100
}
}
该条目已修改为以下内容:
{
"MessageId": "33909eaf-56a1-4467-a01a-64b94f10490c"
"MessageType": "TeamUpdated",
"CreationDate": "20-01-2016",
"Payload": {
"Id": "11111www-56a1-4467-a01a-64b94f000111",
"Name": "Toronto Maple Leafs",
"League": "NHL NorthEast",
"Rating": 50
}
}
正如你所看到的,他是你pdated消息仍然保留所有属性的值,而不仅仅是作为团队评级的已更改属性。
我的模型在实际系统中有超过50个属性,我不想在每个属性更新时创建单独的事件。特别是因为可能会在一次更新中更改多个属性。
在事件源代码架构中,此场景是否存在定义的模式?
很好解释。 – plalx
+1。如果您的ThingUpdated事件有超过50个属性,那么您绝对需要将其分解为已发生的域事件 – tomliversidge