什么是集合函数?

时间:2018-09-18 09:07:25

标签: c# domain-driven-design event-sourcing

我正尝试在业余时间学习事件采购(使用Greg Youngs Event Store)。我已经设置了一个简单的流,并且可以对其进行读取和写入。

请参见以下链接:https://eventstore.org/docs/getting-started/?tabs=tabid-1%2Ctabid-dotnet-client%2Ctabid-dotnet-client-connect%2Ctabid-4。它说:

“如果您要为事件提供域模型,则流等于聚合函数。”

我认为我以前从未遇到过“聚合函数”一词-我知道聚合根和聚合,但不知道聚合函数。假设我有以下事件:

rootGrid.setTop(anchor)

如果我要在SQL Server中创建事件日志,则它可能看起来像这样(“货物”列包含序列化的对象):

enter image description here

我将在事件存储中拥有哪些事件流?我正在阅读此处的一位用户的答案,该用户似乎对事件采购非常了解,他提出了以下建议:

BookingCreatedEvent
BookingUpdatedEvent

在此基础上,相信事件将被命名为:

AggregateType+AggregateId+Version

因此,有10个事件流。这看起来有些混乱,例如,将汇总ID和版本串联在一起-例如,说我有以下内容:

BookingCreatedEvent511 (51 is the aggregate ID and 1 is the version)
BookingUpdatedEvent511 (51 is the aggregate ID and 1 is the version)
BookingUpdatedEvent512 (51 is the aggregate ID and 2 is the version)
BookingCreatedEvent521 (52 is the aggregate ID and 1 is the version)
BookingUpdatedEvent513 (51 is the aggregate ID and 3 is the version)
BookingCreatedEvent531 (53 is the aggregate ID and 1 is the version)
BookingUpdatedEvent514 (51 is the aggregate ID and 4 is the version)
BookingUpdatedEvent515 (51 is the aggregate ID and 5 is the version)
BookingUpdatedEvent516 (51 is the aggregate ID and 6 is the version)
BookingUpdatedEvent517 (51 is the aggregate ID and 7 is the version)

我怎么知道51745的哪一部分是汇总ID,哪一部分是版本。

我正确理解了吗?

1 个答案:

答案 0 :(得分:1)

  

如果您是事件采购域模型,则流等于聚合函数

我找不到任何有意义的证据。

丹·里奇(Dan Leech)在2014年提交的文档中该部分的原始文字使用了这种拼写方式

  

如果您是事件采购域模型,则流将等于聚合。

克里斯进行更改的提交是available in github,但是它与主要的重写混在一起,所以没有记录下来的更改说明。

  

说我有一个订单汇总(包含订单项),并且有100万个,那么我将有100万个流而不是1

基本上是。

更准确地说,每个流在逻辑上都与其他所有流都隔离开; Event Store无法为您提供一次对多个流进行原子更改的功能。

因此,域模型中的每个立即一致的事务都应恰好写入一个事件流。