问题描述
我知道Jonathan Oliver的事件存储在内部使用了CommitId
.到目前为止,我一直为CommitId
提供一个Guid.NewGuid()
.
I understand the CommitId
is used internally by Jonathan Oliver's event store.So far I've always provided a Guid.NewGuid()
for the CommitId
.
你们每个人什么时候想做些不同的事情?
When would you every want to do anything different?
我不明白为什么它在他的公共域存储库中公开.
I don't understand why it is exposed within his common domain Repository.
任何人都可以对此有所了解吗?
Can anyone can shed some light on this?
推荐答案
通常,CommonDomain不会尝试强制采用一种千篇一律的自以为是的结构.
In general, CommonDomain doesn't try to force a one-size-fits-all opinionated structure.
一种利用它的方法是让编写者使用其唯一的传入命令ID作为CommitId,这意味着竞争(或重试与尚未超时的运行进行竞争)将被拒绝,而无需输入特定的异常进入/考虑/管理冲突解决逻辑.这是用来实现幂等命令的关键原则.
One way to leverage it is by having writers use their unique incoming Command Id as a CommitId - this means that competing (or retries competing with runs that have yet to time out) will get rejected with a specific exception without needing to enter into/consider/manage Conflict Resolution logic. This is used to fulfil the key tenet of Idempotent Commands.
这篇关于EventStore Commit Guid,它的真正用途是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!