You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So, there is essentially a one-to-many relationship between User and Identity. The code to create a new relationship between a User instance and an Identity instance could look something like this:
It is technically possible that the resulting events of one of the commands fail to be applied or persisted, while the events of the other command are successfully handled. This would result in the application's state being incorrect, as the relationship between the instances would be incomplete. In relational databases, it is common to have the option of grouping multiple mutations into a single transaction. This ensures that the transaction will only be committed if all the mutations are successful. I was wondering if there is a similar concept in CQRS/ES. Or is there maybe a better way to model relationships between aggregates?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have the following two aggregates:
So, there is essentially a one-to-many relationship between
User
andIdentity
. The code to create a new relationship between aUser
instance and anIdentity
instance could look something like this:It is technically possible that the resulting events of one of the commands fail to be applied or persisted, while the events of the other command are successfully handled. This would result in the application's state being incorrect, as the relationship between the instances would be incomplete. In relational databases, it is common to have the option of grouping multiple mutations into a single transaction. This ensures that the transaction will only be committed if all the mutations are successful. I was wondering if there is a similar concept in CQRS/ES. Or is there maybe a better way to model relationships between aggregates?
Beta Was this translation helpful? Give feedback.
All reactions