AggregateId disconnection between aggregate and state
See original GitHub issueThis trips me several times, and smells duplication:
- I have to compute the aggregate id in application service handlers,
- Then again in the
When
method in aggregate state
Also, if I don’t set the Id
explicit on my state object, at least on the very first event, then my aggregate has no id.
I can see why the service need me to compute the id from incoming command, but the id is known at the time When
runs. Which means it’s known to the aggregate. Is it really necessary to keep the id in the aggregate state?
Issue Analytics
- State:
- Created a year ago
- Comments:25 (16 by maintainers)
Top Results From Across the Web
DDD loophole when one aggregate operation depends on ...
DDD loophole when one aggregate operation depends on state of another aggregate. I have found interesting problem in DDD, which can be solved ......
Read more >Rule: Reference Other Aggregates by Identity
[Evans] states that one Aggregate may hold references to the Root of other ... This technique is called Disconnected Domain Model, ...
Read more >DDD - the rule that Entities can't access Repositories directly
Some will use a Repository (12) from inside an Aggregate for lookup. This technique is called Disconnected Domain Model, and it's actually a ......
Read more >Cosmos: Expose/manage SessionToken #192 - jet/equinox
... (Session) involves round-tripping a SessionToken value between the outcome of ... AggregateId disconnection between aggregate and state ...
Read more >Beginner's Guide to Event Sourcing
All aggregated data needs to be saved successfully. If one rule or operation fails then the whole state change is rejected. In Event...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Seems like I am solving it here https://github.com/Eventuous/eventuous/issues/111 https://github.com/Eventuous/eventuous/discussions/114
Ok, I want to close this one. I feel that I explained enough here https://github.com/Eventuous/eventuous/issues/75#issuecomment-1091655259
Now if you try to persist an aggregate without an id, it will throw. It’s a good enough guard rail.
Any improvements in terms of code are of course welcome, but I have to focus on other things.