Exemplo n.º 1
0
        public ValidationResult ValidateFor(object instance)
        {
            Throw.IfArgumentNull(instance, nameof(instance));

            if (_validationConfiguration.IgnoredTypes.Any(t => t.IsInstanceOfType(instance)))
            {
                return(new ValidationResult());
            }

            var errors = new ValidationErrorCollection();

            foreach (var validator in _validators)
            {
                foreach (var validationError in validator.Validate(instance))
                {
                    errors.Add(validationError);
                }
            }
            var result = new ValidationResult();

            result.Errors.AddRange(errors);
            return(result);
        }
Exemplo n.º 2
0
 public ValidationResult()
 {
     Errors = new ValidationErrorCollection();
 }