Ejemplo n.º 1
0
        public PerspectiveAggregate(Action<IEvent> observer, PerspectiveAggregateState state)
        {
            _observer = observer;
            _state = state;

            if (!_state.Created)
            {
                Apply(new PerspectiveCreated());
            }
        }
Ejemplo n.º 2
0
        public static IEnumerable <IEvent> LoadProject(IEnumerable <IEvent> given, IEnumerable <ICommand> when)
        {
            var state = new PerspectiveAggregateState();

            foreach (var @event in given)
            {
                state.Apply(@event);
            }

            var result = new List <IEvent>();
            var ar     = new PerspectiveAggregate(result.Add, state);

            foreach (var c in when)
            {
                ar.Execute(c);
            }
            return(result);
        }