Пример #1
0
        private IEnumerable<ModelValidator> GetValidators(Type dataType,ModelValidatorProvider validatorProvider)
        {
            ModelMetadata metadata = ModelMetadataProviders.Current.GetMetadataForType(null, dataType);

            foreach (var validator in validatorProvider.GetValidators(metadata,ControllerContext))
            {
                yield return validator;
            }

            foreach (var propertyMetadata in metadata.Properties)
            {
                foreach (var validator in validatorProvider.GetValidators(propertyMetadata, ControllerContext))
                {
                    yield return validator;
                }
            }
        }
 public GettextModelValidatorProvider(ModelValidatorProvider implementation)
 {
     if (implementation == null) throw new ArgumentNullException("implementation");
     this.implementation = implementation;
 }
 public GenericsValidatorProvider(ModelValidatorProvider delegatingProvider, ValidationMappings mappings = null)
 {
     _delegatingProvider = delegatingProvider;
     _mappings = mappings ?? ConfigurationHolder.ValidationMappings;
 }