How To Add Custom ModelValidatorProviders To Web API Project?
Posted
by
Mark S.
on Stack Overflow
See other posts from Stack Overflow
or by Mark S.
Published on 2012-10-15T22:57:15Z
Indexed on
2012/10/15
23:01 UTC
Read the original article
Hit count: 219
I'm moving some MVC code to Web API and I need to update my custom ModelValidatorProviders. It seems as though my validators can stay much the same only they should inherit the System.Web.Http.Validation namespace.
What I can't figure out is how to add the provider to Web API. When using MVC I can just add the following to my global.asax:
ModelValidatorProviders.Providers.Add(new CustomModelValidatorProvider());
How do I use the custom provider with Web API?
© Stack Overflow or respective owner