void Update(ICommand<SecurityId> c, Action<SecurityAggregate> action) { var eventStream = _eventStore.LoadEventStream(c.Id); var state = new SecurityState(eventStream.Events); var agg = new SecurityAggregate(state); action(agg); _eventStore.AppendEventsToStream(c.Id, eventStream.StreamVersion, agg.Changes); }
void Update(ICommand <SecurityId> c, Action <SecurityAggregate> action) { var eventStream = _eventStore.LoadEventStream(c.Id); var state = new SecurityState(eventStream.Events); var agg = new SecurityAggregate(state); action(agg); _eventStore.AppendEventsToStream(c.Id, eventStream.StreamVersion, agg.Changes); }
void Update(ICommand <SecurityId> c, Action <SecurityAggregate> action) { var eventStream = _eventStore.LoadEventStream(c.Id); var state = new SecurityState(eventStream.Events); var agg = new SecurityAggregate(state); using (Context.CaptureForThread()) { action(agg); _eventStore.AppendToStream(c.Id, eventStream.Version, agg.Changes); } }
void Update(ICommand<SecurityId> c, Action<SecurityAggregate> action) { var eventStream = _eventStore.LoadEventStream(c.Id); var state = new SecurityState(eventStream.Events); var agg = new SecurityAggregate(state); using (var capture = Context.CaptureForThread()) { action(agg); _eventStore.AppendToStream(c.Id, eventStream.Version, agg.Changes, capture.Log); } }
public SecurityAggregate(SecurityState state) { _state = state; }