public ValidationRules AddRule(string message, Func <object, bool> validator)
        {
            AnonymousRule        rule      = new AnonymousRule();
            List <AnonymousRule> anonRules = (List <AnonymousRule>)Dictionary.GetDictionary(this)["validation"];

            if (anonRules == null)
            {
                anonRules = new List <AnonymousRule>();
                Dictionary.GetDictionary(this)["validation"] = anonRules;
            }
            rule.message   = message;
            rule.validator = validator;
            anonRules.Add(rule);

            return(this);
        }
Beispiel #2
0
        public ValidationRules AddRule(string message, Func<object,bool> validator)
        {
            AnonymousRule rule = new AnonymousRule();
            List<AnonymousRule> anonRules = (List<AnonymousRule>) Dictionary.GetDictionary(this)["validation"];
            if (anonRules == null)
            {
                anonRules = new List<AnonymousRule>();
                Dictionary.GetDictionary(this)["validation"] = anonRules;
            }
            rule.message = message;
            rule.validator = validator;
            anonRules.Add(rule);

            return this;
        }