--
You received this message because you are subscribed to the Google Groups "DDD/CQRS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dddcqrs+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/dddcqrs.
For more options, visit https://groups.google.com/d/optout.
Why would you need to load all events to check for existence? Couldn't you just see if the stream exists?
On Tue, Sep 19, 2017 at 9:08 PM, Federico G <fed...@gmail.com> wrote:
Hello,
When using CQRS, how should I validate the existence of another aggregate? For example, when creating an order I need to validate that the customer exists, and I have the customer ID (applying the rule of referring to other aggregates by id only) as part of the CreateOrder command data.
Assuming I have a CustomerRepository injected to perform the validation, I see two options to query the customer for existence inside the repository:
1. Validating against a customer Read Model - easiest choice, need to be careful if applying eventual consistency or I could hit false negatives.
2. Validating against a customer Aggregate rehydrated from events - no eventual consistency issue, but it seems as an overkill to do this only to check for existence (and I understand the Aggregate is used only for sending commands, not for querying).
How would you handle this? Is there another option?
--
You received this message because you are subscribed to the Google Groups "DDD/CQRS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dddcqrs+u...@googlegroups.com.
Visit this group at https://groups.google.com/group/dddcqrs.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to dddcqrs+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/dddcqrs.
For more options, visit https://groups.google.com/d/optout.