-
Notifications
You must be signed in to change notification settings - Fork 534
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
Event is mutable #20
Comments
Hi @beachwalker , I know that this issue is quite old, but I would like to contribute. The reason for which the Event class is mutable is related to the need of assigning the right version to the event itself, when the event is appended to the event stream. This is done right after the optimistic concurrency check in the Two subjects somewhat related to this are the issue #7 and the issue #31 that I recently opened in order to better understand what is the semantic of the If my interpretation of the
I'm quite confident that assigning the Version to an event in advance (before performing the optimistic concurrency check) won't break anything on the correctness side: if there are concurrency issues the events won't be appended to the event stream so the Version assigned to them is not relevant. Otherwise, in case of a successful optimistic concurrency check, the event Version assigned this way is exactly the same as the one assigned by the currently existing code (because the command is performed against the most recent aggregate version available and, when the events are saved, the aggregate version in the event store is not changed because the optimistic concurrency check was successful). |
This makes Event a mutable type.
I think Commands and Events should be immutable instead.
The text was updated successfully, but these errors were encountered: