Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class AggregateRepository
- {
- // IRL this should be a data store of sorts
- private static Dictionary<Guid, List<Event>> eventStore = new Dictionary<Guid, List<Event>>();
- public void Save(Aggregate aggregate)
- {
- if (!eventStore.ContainsKey(aggregate.Id))
- eventStore[aggregate.Id] = new List<Event>();
- eventStore[aggregate.Id].AddRange(aggregate.NewEvents); // OK, a bit more involved IRL
- }
- }
Add Comment
Please, Sign In to add comment