public void Fire() { var actionContext = new ActionContext(); while (_agenda.HasActiveRules() && !actionContext.IsHalted) { Activation activation = _agenda.NextActivation(); ICompiledRule rule = activation.Rule; _eventAggregator.RuleFiring(activation); foreach (IRuleAction action in rule.Actions) { action.Invoke(actionContext, activation.Tuple); ApplyActionOperations(actionContext); } _eventAggregator.RuleFired(activation); } }
public void Fire() { while (_agenda.HasActiveRules()) { Activation activation = _agenda.NextActivation(); ICompiledRule rule = activation.Rule; var actionContext = new ActionContext(rule.Definition, this); _eventAggregator.RaiseRuleFiring(this, activation); foreach (IRuleAction action in rule.Actions) { action.Invoke(_executionContext, actionContext, activation.Tuple, activation.TupleFactMap, rule.Dependencies); } _eventAggregator.RaiseRuleFired(this, activation); if (actionContext.IsHalted) { break; } } }