-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unique field validation #153
Comments
Also the way
is not a suitable because for every check we need to load the whole aggregate with full list of emails and then make check directly in code (in cycle?). What if we have > 1k users? We cannot make such complex operation just for simple checking for uniqueness. Thanks for reply in advance. |
Hehe... welcome to the cqrs world... |
Found similar question on stackoverflow |
Having what @adrai said in mind, there are a few patterns you can apply to solve your problem, after you have decided that cqrs/es is suitable for youe user/account management:
|
The second approach is quite clear. But in the first one, how should we manage email change? If we set an email as an aggregate id, then change email (and it was aggregate id), it causes that any other entities that have this aggregate id (email, in this case) inside would be linked to non-existent/invalid aggregate. |
This is why I said, you need 1 aggregate for all email addresses... |
I wish you a speedy recovery! |
refers to #70, #91
Hi, I have the similar question: how to make checks for uniqueness in domain?
I tried to check it using eventDenormalizer by saving unique values (emails) into VM by listen domain events and then check it in preCondition:
but this way is not atomic, theoretically there can be situation when 2 users can create their accounts with the same emails. How to avoid this?
The text was updated successfully, but these errors were encountered: