Reputation: 1557
Are there any examples/guides how to implement custom IBodyModelValidator for ASP.NET MVC WebAPI stack? Tried to google it but found nothing interesting...
Upvotes: 2
Views: 1193
Reputation: 12184
There doesn't seem to be a lot of examples I agree.
It depends on what you are actually trying to achieve in your custom validation - but given the DefaultBodyModelValidator
actually defers it's validation out to the correct validators for the model (by looking up the required validator via the ModelValidatorProvidor
)... perhaps your logical extension point should instead be to implement a custom ModelValidatorProvidor
(example here) and then let the BodyModelValidator defer to it instead.
In any case the best example of how to implement a custom one is probably to look at the code for the Default one. This is available on the CodePlex site here.
Upvotes: 4