Exemple #1
0
 public void AddSinglePropertyRule(string property, IRule rule)
 {
     if (property.Equals(nameof(HasErrors))) return;
     if (property.Equals(nameof(ErrorLevel))) return;
     if (_RuleMap.ContainsKey(property))
     {
         _RuleMap[property].AddRule(rule);
     }
     else
     {
         Validation.PropertyRule r = new Validation.PropertyRule(rule);
         _RuleMap.Add(property, r);
     }
 }
Exemple #2
0
 public void AddMultiPropertyRule(List<string> properties, IRule rule)
 {
     foreach (string prop in properties)
     {
         if (prop.Equals(nameof(HasErrors))) continue;
         if (prop.Equals(nameof(ErrorLevel))) continue;
         if (_RuleMap.ContainsKey(prop))
         {
             _RuleMap[prop].AddRule(rule);
         }
         else
         {
             Validation.PropertyRule r = new Validation.PropertyRule(rule);
             _RuleMap.Add(prop, r);
         }
     }
 }