void Update(ICommand<FactoryId> c, Action<FactoryAggregate> action) { var eventStream = _eventStore.LoadEventStream(c.Id); var state = new FactoryState(eventStream.Events); var agg = new FactoryAggregate(state); action(agg); _eventStore.AppendEventsToStream(c.Id, eventStream.StreamVersion, agg.Changes); }
void Update(ICommand <FactoryId> c, Action <FactoryAggregate> action) { var eventStream = _eventStore.LoadEventStream(c.Id); var state = new FactoryState(eventStream.Events); var agg = new FactoryAggregate(state); action(agg); _eventStore.AppendEventsToStream(c.Id, eventStream.StreamVersion, agg.Changes); }