Ejemplo n.º 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(ITrustedSystemEvent 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);
        }
Ejemplo n.º 2
0
        public void MakeStateRealize(ITrustedSystemEvent thisEventTypeHappened)
        {
            #region What Is This Code/Syntax Doing?
            // Announce that a specific Type of Event Message occured
            // so that this AggregateState instance can Realize it and change its state because of it.
            // We are telling the compiler to call one of the "When" methods in this class to achieve this realization.
            // The "dynamic" syntax below is just a shortcut we are using so we don't
            // have to create a large if/else block for a bunch of type-specific static Event types.
            // This shortcut using the "dynamic" keyword syntax means:
            // "Call the 'When' method of 'this' AggregateState instance
            // that has a method signature of:
            // When(WhateverTheEventTypeIsOf-thisEventTypeHappened)".
            #endregion

            ((dynamic)this).When((dynamic)thisEventTypeHappened);
        }
        /// <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(ITrustedSystemEvent 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);
        }
Ejemplo n.º 4
0
        public void MakeStateRealize(ITrustedSystemEvent thisEventTypeHappened)
        {
            #region What Is This Code/Syntax Doing?
            // Announce that a specific Type of Event Message occured
            // so that this AggregateState instance can Realize it and change its state because of it.
            // We are telling the compiler to call one of the "When" methods in this class to achieve this realization.
            // The "dynamic" syntax below is just a shortcut we are using so we don't
            // have to create a large if/else block for a bunch of type-specific static Event types.
            // This shortcut using the "dynamic" keyword syntax means:
            // "Call the 'When' method of 'this' AggregateState instance
            // that has a method signature of:
            // When(WhateverTheEventTypeIsOf-thisEventTypeHappened)".
            #endregion

            ((dynamic)this).When((dynamic)thisEventTypeHappened);
        }