예제 #1
0
        public static ValidationResults Validate <T>(T target, params string[] rulesets)
        {
            if (rulesets == null)
            {
                throw new ArgumentNullException("rulesets");
            }
            ValidationResults results = new ValidationResults();

            foreach (string str in rulesets)
            {
                foreach (ValidationResult result in (IEnumerable <ValidationResult>)ValidationFactory.CreateValidator <T>(str).Validate(target))
                {
                    results.AddResult(result);
                }
            }
            return(results);
        }
예제 #2
0
        public static ValidationResults Validate <T>(T target, params string[] rulesets)
        {
            if (rulesets == null)
            {
                throw new ArgumentNullException("rulesets");
            }
            ValidationResults validationResults = new ValidationResults();

            foreach (string ruleset in rulesets)
            {
                Validator <T> validator = ValidationFactory.CreateValidator <T>(ruleset);
                foreach (ValidationResult item in (IEnumerable <ValidationResult>)validator.Validate(target))
                {
                    validationResults.AddResult(item);
                }
            }
            return(validationResults);
        }
예제 #3
0
        public static ValidationResults Validate <T>(T target, params string[] rulesets)
        {
            if (rulesets == null)
            {
                throw new ArgumentNullException("rulesets");
            }
            ValidationResults validationResults = new ValidationResults();

            for (int i = 0; i < rulesets.Length; i++)
            {
                string        ruleset   = rulesets[i];
                Validator <T> validator = ValidationFactory.CreateValidator <T>(ruleset);
                foreach (ValidationResult current in ((IEnumerable <ValidationResult>)validator.Validate(target)))
                {
                    validationResults.AddResult(current);
                }
            }
            return(validationResults);
        }
예제 #4
0
 public static Validator CreateValidator(Type targetType)
 {
     return(ValidationFactory.CreateValidator(targetType, string.Empty));
 }
예제 #5
0
 public static Validator <T> CreateValidator <T>(string ruleset)
 {
     return(ValidationFactory.CreateValidator <T>(ruleset, true));
 }
예제 #6
0
 public static Validator <T> CreateValidator <T>()
 {
     return(ValidationFactory.CreateValidator <T>(string.Empty, true));
 }
예제 #7
0
 public static Validator CreateValidator(Type targetType, string ruleset)
 {
     return(ValidationFactory.CreateValidator(targetType, ruleset, true));
 }
예제 #8
0
        public static ValidationResults Validate <T>(T target)
        {
            Validator <T> validator = ValidationFactory.CreateValidator <T>();

            return(validator.Validate(target));
        }
예제 #9
0
 public static ValidationResults Validate <T>(T target)
 {
     return(ValidationFactory.CreateValidator <T>().Validate(target));
 }