Open xiongdashan opened 4 years ago
Potentially yes if there are a lot of events, and I mean a lot. One way to mitigate the potential issue is to create snapshots and retrieve only events from a certain point in time. I have already created an issue to address this and I hope to have the time to implement the feature at some point.
Thanks for your answer, could load aggregateroot after the event, update the changed data and save it again, and then load only the most recent update in the loadhistory method? That is, the first entry in the event table is the complete latest data. It only needs to take top 1 each time.
Yes, it could be possible by saving a snapshot of the whole aggregate for each event.
Create a new table or use the current event table? Which is right?
Same table or container, just an extra property for the event (e.g. Snapshot)
I have a question: In "AggregateRoot.cs", the value is assigned to it by looping through all events. If there are a lot of Events,will it cause performance issues?
Load all events
https://github.com/lucabriguglia/Kledex/blob/467c4a4af12d733173a8b1751dff3001618a3e9d/src/Kledex.Store.EF/StoreProvider.cs#L54
Foreach all events and assgin value:
https://github.com/lucabriguglia/Kledex/blob/467c4a4af12d733173a8b1751dff3001618a3e9d/src/Kledex/Domain/AggregateRoot.cs#L30