Пример #1
0
        // announcements inside the factory that get called by
        // the dynamic code shortcut in the Mutate method below.
        // As these methods change the content inside of the properties (lists inside) they call,
        // our understanding of the current state of the factory is updated.
        // It is important to note that the official state of the factory
        // that these methods change, only changes AFTER each event they react to
        // has been RECORDED in the journal of "Changes" defined at the start of this file.
        // If an event hasn't been recorded in the CHanges list, the state
        // of the factory WILL NOT CHANGE.  State changes are ALWAYS reflected in the
        // stream of events inside of the Changes journal because these
        // "Announce" methods below are not executed until events have been logged 
        // to the Changes journal and have been called by "RecordThat"'s call to "Mutate".
        // This is a very powerful aspect of event sourcing (ES).
        // We should NEVER directly modify these aggregate state variables
        // (by calling the list directly for example), they are only ever modifed
        // as side effects of events that have occured and have been logged.
        // Pretty much ensures a perfect audit log of what has happened.


        void AnnounceInsideFactory(EmployeeAssignedToFactory theEvent)
        {
            ListOfEmployeeNames.Add(theEvent.EmployeeName);
        }
Пример #2
0
        // announcements inside the factory that get called by
        // the dynamic code shortcut in the Mutate method below.
        // As these methods change the content inside of the properties (lists inside) they call,
        // our understanding of the current state of the factory is updated.
        // It is important to note that the official state of the factory
        // that these methods change, only changes AFTER each event they react to
        // has been RECORDED in the journal of "Changes" defined at the start of this file.
        // If an event hasn't been recorded in the CHanges list, the state
        // of the factory WILL NOT CHANGE.  State changes are ALWAYS reflected in the
        // stream of events inside of the Changes journal because these
        // "Announce" methods below are not executed until events have been logged
        // to the Changes journal and have been called by "RecordThat"'s call to "Mutate".
        // This is a very powerful aspect of event sourcing (ES).
        // We should NEVER directly modify these aggregate state variables
        // (by calling the list directly for example), they are only ever modifed
        // as side effects of events that have occured and have been logged.
        // Pretty much ensures a perfect audit log of what has happened.


        void AnnounceInsideFactory(EmployeeAssignedToFactory theEvent)
        {
            ListOfEmployeeNames.Add(theEvent.EmployeeName);
        }