예제 #1
0
        /// <summary>
        /// Loads rules into a rule set using provided loader specification.
        /// <seealso cref="IRuleLoadSpec"/>
        /// </summary>
        /// <param name="specAction">Rule loader specification.</param>
        public void Load(Action<IRuleLoadSpec> specAction)
        {
            var spec = new RuleLoadSpec(Activator);
            specAction(spec);

            var ruleSetName = spec.RuleSetName ?? DefaultRuleSetName;
            var ruleSet = GetRuleSet(ruleSetName);

            var rules = spec.Load();
            ruleSet.Add(rules);
        }
예제 #2
0
        /// <summary>
        /// Loads rules into a rule set using provided loader specification.
        /// </summary>
        /// <param name="ruleSetName">Name of the rule set.</param>
        /// <param name="specAction">Rule loader specification.</param>
        public void Load(string ruleSetName, Action<IRuleLoadSpec> specAction)
        {
            var spec = new RuleLoadSpec();
            specAction(spec);

            var rules = spec.Load()
                .Select(t => Activator.Activate(t))
                .Select(r => r.GetDefinition());

            var ruleSet = GetRuleSet(ruleSetName);
            ruleSet.Add(rules);
        }
예제 #3
0
        /// <summary>
        /// Loads rules into a rule set using provided loader specification.
        /// <seealso cref="IRuleLoadSpec"/>
        /// </summary>
        /// <param name="specAction">Rule loader specification.</param>
        public void Load(Action <IRuleLoadSpec> specAction)
        {
            var spec = new RuleLoadSpec(Activator);

            specAction(spec);

            var ruleSetName = spec.RuleSetName ?? DefaultRuleSetName;
            var ruleSet     = GetRuleSet(ruleSetName);

            var rules = spec.Load();

            ruleSet.Add(rules);
        }
예제 #4
0
        /// <summary>
        /// Loads rules into a rule set using provided loader specification.
        /// </summary>
        /// <param name="ruleSetName">Name of the rule set.</param>
        /// <param name="specAction">Rule loader specification.</param>
        public void Load(string ruleSetName, Action <IRuleLoadSpec> specAction)
        {
            var spec = new RuleLoadSpec();

            specAction(spec);

            var rules = spec.Load()
                        .Select(t => Activator.Activate(t))
                        .Select(r => r.GetDefinition());

            var ruleSet = GetRuleSet(ruleSetName);

            ruleSet.Add(rules);
        }