本文介绍了CQRS中的域查询的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在尝试。

它解决了这个问题。在CQRS中要解决的问题很复杂。 Bjarte的建议是查询报表数据库中现有的客户电子邮件地址,如果有电子邮件,则向域模型发出补偿命令(例如 CustomerEmailAddressIsNotUniqueCompensatingCommand )找到地址。然后,您可以触发适当的事件,其中可能包括 UndoCustomerCreationEvent

It addresses this very issue. It's a complex issue to deal with in CQRS. What Bjarte is suggesting is to query the reporting database for existing Customer e-mail addresses and issue a Compensating Command (such as CustomerEmailAddressIsNotUniqueCompensatingCommand) back to the Domain Model if an e-mail address was found. You can then fire off appropriate events, which may include an UndoCustomerCreationEvent.

通读以上博客中的评论

建议在评论中,验证是域关注的问题。结果,您可以将ReservedEmailAddresses存储在一项服务中,该服务可以促进客户创建,并被事件存储中的事件所淹没。

Adam D. suggests in a comment that validation is a domain concern. As a result, you can store ReservedEmailAddresses in a service that facilitates customer creation and is hydrated by events in your event store.

我不确定是否有一种简单的解决方案这个感觉完全干净的问题。让我知道您的想法!

I'm not sure there's an easy solution to this problem that feels completely clean. Let me know what you come up with!

祝您好运!

这篇关于CQRS中的域查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-22 10:21