Domain queries in CQRS

后端 未结 4 820
悲&欢浪女
悲&欢浪女 2020-12-12 14:03

We are trying out CQRS. We have a validation situation where a CustomerService (domain service) needs to know whether or not a Customer exists. Customers are unique by their

4条回答
  •  -上瘾入骨i
    2020-12-12 14:44

    This issues does not have to be that complex:

    1. Check your reporting store for customer uniqueness before submitting the UpdateCustomer command.
    2. Add a constraint to your DB for uniqueness on email address. When executing the command, handle the exception and send a notification to the user using a reply channel. (hences never firing CustomerUpdated events to the reporting store.

    Use the database for what it's good for and don't get hung up on ORM limitations.

提交回复
热议问题