示例#1
0
        /// <summary>
        /// Invokes all rule methods associated with
        /// the specified property and any
        /// dependant properties.
        /// </summary>
        /// <param name="propertyName">The name of the property to validate.</param>
        public void CheckRules(string propertyName)
        {
            // get the rules dictionary
            ValidationRulesManager rules = RulesToCheck;

            if (rules != null)
            {
                // get the rules list for this property
                RulesList rulesList = rules.GetRulesForProperty(propertyName, false);
                if (rulesList != null)
                {
                    // get the actual list of rules (sorted by priority)
                    List <IRuleMethod> list = rulesList.GetList(true);
                    if (list != null)
                    {
                        CheckRules(list);
                    }
                    List <string> dependancies = rulesList.GetDependancyList(false);
                    if (dependancies != null)
                    {
                        for (int i = 0; i < dependancies.Count; i++)
                        {
                            string dependantProperty = dependancies[i];
                            CheckRules(rules, dependantProperty);
                        }
                    }
                }
            }
        }
示例#2
0
        private void CheckRules(ValidationRulesManager rules, string propertyName)
        {
            // get the rules list for this property
            RulesList rulesList = rules.GetRulesForProperty(propertyName, false);

            if (rulesList != null)
            {
                // get the actual list of rules (sorted by priority)
                List <IRuleMethod> list = rulesList.GetList(true);
                if (list != null)
                {
                    CheckRules(list);
                }
            }
        }