Created
November 15, 2012 09:21
-
-
Save bzbetty/4077597 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