// announcements inside the factory that // get called by the dynamic code shortcut above. // As these methods change the content inside of the lists 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. If an event hasn't been recorded, the state // of the factory WILL NOT CHANGE. State changes are ALWAYS reflected in the // stream of events inside of the journal because these methods are not // executed until events have been logged to the journal. // This is a very powerful aspect of event sourcing (ES). // We should NEVER directly modify the 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 e) { _ourListOfEmployeeNames.Add(e.EmployeeName); }
public void When(EmployeeAssignedToFactory e) { List.Add(Tuple.Create(e.EmployeeName, e.Id)); }
// announcements inside the factory that get called by // the dynamic code shortcut in the ChangeMyStateBecauseOf 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 "EventsThatHappened" defined at the start of this file. // If an Event hasn't been recorded in the EventsThatHappened list, the state // of the factory WILL NOT CHANGE. State changes are ALWAYS reflected in the // stream of Events inside of the EventsThatHappened journal because these // "Announce" methods below are not executed until Events have been logged // to the EventsThatHappened journal and have been called by the "RecordThat"'s call to "ChangeMyStateBecauseOf". // 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. // This approach pretty much ensures a perfect audit log of all things that have ever happened. #endregion void AnnounceInsideFactory(EmployeeAssignedToFactory theEvent) { ListOfEmployeeNames.Add(theEvent.EmployeeName); }
public void When(EmployeeAssignedToFactory theEvent) { ListOfEmployeeNames.Add(theEvent.EmployeeName); }
// announcements inside the factory void When(EmployeeAssignedToFactory e) { ListOfEmployeeNames.Add(e.EmployeeName); }
public void When(EmployeeAssignedToFactory e) { Factories[e.Id].WorkerCount += 1; }