Need to understand AggregateState better #108
-
I feel i am using AggregateState for doing bussiness validation only and data is store in event store and projection.. Is it good as per pattern that i store only fields needed for bussiness to be store in AggregateState as other data we have in event store and projection |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
The aggregate state is rebuilt from events, so you can add and remove new properties to the state instance at will, as long as you can restore the state from historical events. The approach of only keeping the properties you need for making decisions is a good one. You need, however, to ensure that your events contain enough information for both aggregate state and projections to be rebuilt without any need to reach out to external data sources, or use read models. |
Beta Was this translation helpful? Give feedback.
The aggregate state is rebuilt from events, so you can add and remove new properties to the state instance at will, as long as you can restore the state from historical events. The approach of only keeping the properties you need for making decisions is a good one. You need, however, to ensure that your events contain enough information for both aggregate state and projections to be rebuilt without any need to reach out to external data sources, or use read models.