Guest User

Untitled

a guest
Oct 24th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. public class AggregateRepository
  2. {
  3. // IRL this should be a data store of sorts
  4. private static Dictionary<Guid, List<Event>> eventStore = new Dictionary<Guid, List<Event>>();
  5.  
  6. public void Save(Aggregate aggregate)
  7. {
  8. if (!eventStore.ContainsKey(aggregate.Id))
  9. eventStore[aggregate.Id] = new List<Event>();
  10. eventStore[aggregate.Id].AddRange(aggregate.NewEvents); // OK, a bit more involved IRL
  11. }
  12. }
Add Comment
Please, Sign In to add comment