Created
December 20, 2012 07:08
-
-
Save bzbetty/4343463 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class ValidatorProvider : DataAnnotationsModelValidatorProvider | |
{ | |
private IConfigurationProvider _mapper; | |
public ValidatorProvider(IConfigurationProvider mapper) | |
{ | |
_mapper = mapper; | |
} | |
protected override System.Collections.Generic.IEnumerable<ModelValidator> GetValidators(System.Web.Mvc.ModelMetadata metadata, ControllerContext context, IEnumerable<Attribute> attributes) | |
{ | |
var mappedAttributes = _mapper.GetMappedAttributes(metadata.ContainerType, metadata.PropertyName, attributes); | |
return base.GetValidators(metadata, context, mappedAttributes); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment