void Update(ICommand<UserId> c, Action<UserAggregate> action)
        {
            var stream = _store.LoadEventStream(c.Id);
            var state = new UserState(stream.Events);
            var agg = new UserAggregate(state);

            using (var capture = Context.CaptureForThread())
            {
                agg.ThrowOnInvalidStateTransition(c);
                action(agg);
                _store.AppendToStream(c.Id, stream.Version, agg.Changes, capture.Log);
            }
        }
Ejemplo n.º 2
0
 public UserAggregate(UserState state)
 {
     _state = state;
 }