public Validator AddRule(Type type, IValidator validator, ErrorMessage msg)
        {
            ValidationUnitCollection coll = GetRules(type);

            coll.Add(ValidationUnit.CreateValidationUnit(msg, validator));
            return(this);
        }
 /// <summary>
 /// Given an array of object of validation attributes create all
 /// requested ValidationUnits.
 /// </summary>
 /// <param name="vc"></param>
 ///<param name="valueExtractor">The value extractor proposed by the caller
 /// the real value extractor can be overriden by the attribute.</param>
 /// <param name="validationfields"></param>
 private static void BuildValidationUnitFromAttributeList(
     ValidationUnitCollection vc,
     IValueExtractor valueExtractor,
     object[] validationfields)
 {
     foreach (BaseValidationAttribute va in validationfields)
     {
         if (va.IsValueExtractorOverriden)
         {
             valueExtractor = va.CreateValueExtractor();
         }
         vc.Add(ValidationUnit.CreateValidationUnit(
                    va.CreateErrorMessage(),
                    va.CreateValidator(valueExtractor)));
     }
 }