예제 #1
0
        internal RulesEngine(ConditionEvaluatorFactory evaluators, TimeMachine timeMachine)
            : this()
        {
            _evaluators = evaluators;

            _validators = new List<BaseElementValidator>
            {
                new IsElementActiveEvaluator(timeMachine),
            };
        }
예제 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RulesEngine"/> class.
 /// </summary>
 /// <param name="evaluators">Functor to resolve all evaluators.</param>
 /// <example>
 /// This is an example of using the rules engine only one condition evaluator, which is the included example <see cref="BooleanCondition"/>.
 /// <code><![CDATA[
 ///    var rulesEngine =
 ///        new RulesEngine.RulesEngine(
 ///            new ConditionEvaluatorFactory(() => new List<IConditionEvaluator> { new BooleanCondition() }));
 /// ]]>
 /// </code>
 /// We can directly pass IEnumerable object to the  constructor:
 /// <code><![CDATA[
 ///    var rulesEngine =
 ///        new RulesEngine.RulesEngine(
 ///            new ConditionEvaluatorFactory(new List<IConditionEvaluator> { new BooleanCondition() }));
 /// ]]>
 /// </code>
 /// </example>
 public RulesEngine(ConditionEvaluatorFactory evaluators)
     : this(evaluators, new TimeMachine())
 {
 }