Aggregate Repositories and Event Stores
Learn about a registry for recallable data structures and understand how it's implemented.
Because we will be dealing with aggregates that, regardless of their structure, will be decomposed down to a stream of events, we can create and reuse a single repository and store.
AggregateRepository
and related interfaces
Let us look at AggregateRepository
and the interfaces involved in the following figure:
The Load()
and Save()
methods are the only methods we will use with event-sourced aggregates and their event streams. There are occasions when we would need to delete or alter events in the event store for reasons related to privacy or security concerns. This repository is not going to be capable of that and is not meant for that work. We would have some other specialized implementation we would use to gain access to the additional functions necessary. When working with event stores, securing them, and ensuring that they are in accordance with relevant legislation, ...