MakeStateRealize() public method

public MakeStateRealize ( IClientProfileEvent thisEventTypeHappened ) : void
thisEventTypeHappened IClientProfileEvent
return void
Beispiel #1
0
        /// <summary> Make Aggregate realize the event happened
        /// by applying it to the state and adding to
        /// the list of uncommitted events</summary>
        /// <param name="eventThatHappened"></param>
        void Apply(IClientProfileEvent eventThatHappened)
        {
            // update Agg's in-memory state so if a behavior (method) has
            // multiple steps, each subsequent step has up-to-date state to operate on
            _aggState.MakeStateRealize(eventThatHappened);

            // update Agg's public collection of change causing Events so the
            // AppService can use it to persist AggState as appended Events to this Agg's Event Stream
            EventsCausingChanges.Add((Event)eventThatHappened);
        }
        public static ClientProfileState BuildStateFromEventHistory(IEnumerable<Event> events)
        {
            var aggState = new ClientProfileState();

            foreach (var eventThatHappened in events)
            {
                aggState.MakeStateRealize((IClientProfileEvent)eventThatHappened);
            }
            return aggState;
        }
Beispiel #3
0
        public static ClientProfileState BuildStateFromEventHistory(IEnumerable <Event> events)
        {
            var aggState = new ClientProfileState();

            foreach (var eventThatHappened in events)
            {
                aggState.MakeStateRealize((IClientProfileEvent)eventThatHappened);
            }
            return(aggState);
        }