8
I would like to use a feature of Fluentvalidation calling for ruleset in a web API project, because I don’t want to have to be doing model validation manually every time a action method is called.
So I used the FluentValidationModelValidatorProvider.Configure
to add Fluentvalidation to ModelValidatorProviders
so that my models would be automatically validated before being sent to a action method.
Up to this point everything is fine, but for me to continue the configuration of Fluentvalidation in my project, for it to do the validations automatically, I just need to use the attribute CustomizeValidatorAttribute
models that are desired as follows:
public ActionResul Something([CustomizeValidator(RuleSet = "RuleName")]MyModel myModel)
The problem is that this attribute is only available for the more specific Fluentvalidation package that is intended for ASP.NET MVC. What I could do to have this functionality in the Web API?
According to that Issue there is no forecast for this integration.
– Randrade
+1 For introducing me
FluentValidation
:)– rubStackOverflow
There’s no answer, you can’t do it.
– PauloHDSousa