Ejemplo n.º 1
0
        /// <summary>
        /// Consider a check rulebook. First check each argument for applicable rules, then check for global rules.
        /// A check rulebook continues until a rule returns CheckResult.Allow or CheckResult.Disallow.
        /// </summary>
        /// <param name="Name"></param>
        /// <param name="Arguments"></param>
        /// <returns></returns>
        public CheckResult ConsiderCheckRule(String Name, params Object[] Arguments)
        {
            if (Arguments == null)
            {
                Arguments = new Object[] { null }
            }
            ;

            foreach (var ruleset in EnumerateRuleSets(Arguments))
            {
                var r = ruleset.ConsiderCheckRule(Name, Arguments);
                if (r != CheckResult.Continue)
                {
                    return(r);
                }
            }

            if (Rules == null)
            {
                throw new InvalidOperationException();
            }
            return(Rules.ConsiderCheckRule(Name, Arguments));
        }