public void RunReaction(IStateChangeReaction reaction) { var changes = _context.TimeAndStates.ToList(); foreach (var c in changes) { var result = reaction.OnChange(c.Entity, c.Key, c.PriorValue, c.Value, c.On.ToString("MM/dd/yyyy HH:mm:ss.fffffff")); if (result.NewObservations != null) { foreach (var ob in result.NewObservations) { this.RegisterObservation(ob); } } if (result.NewEvents != null) { foreach (var ev in result.NewEvents) { this.RegisterEvent(ev); } } } }
public void RegisterReaction(IStateChangeReaction reaction) { _eventAgents.Add(reaction); }