Data Annotations Constructor Injection
asp.net, asp.net-mvc, data-annotations
Solution
You can't use Controller injection from what I see using Reflector, but it does appear possible to use property injection. By creating a class that inherits from `DataAnnotationsModelValidatorProvider`, and by overriding the method `GetValidators`, it seems plausible that the attributes can be property injected into before the validation happens... this is from an initial analysis, yet to be fully determined.
Problem
With ASP.NET MVC, is it possible to use constructor injection with the data annotation attributes (specifically, I'm using validation attributes)? What I would like to be able to do is: ``` public class NoEmailTakenAttribute : ValidationAttribute { public NoEmailTakenAttribute(IService service) { .. } } ``` Is that possible? Thanks.