Quantcast
Channel: Fluent Validation for .NET
Viewing all articles
Browse latest Browse all 1917

New Post: Web API 2

$
0
0
Yes!
just get this fork : https://fluentvalidation.codeplex.com/SourceControl/network/forks/mahmoud690/WebApi2

and at your project startup set this :
        {
            GlobalConfiguration.Configuration.Services.Add(
                typeof(System.Web.Http.Validation.ModelValidatorProvider),
                new WebApiFluentValidationModelValidatorProvider()
                {
                    AddImplicitRequiredValidator = false //we need this otherwise it invalidates all not passed fields(through json). btw do it if you need
                });
            FluentValidation.ValidatorOptions.ResourceProviderType = typeof(FluentValidationMessages); // if you have any related resource file (resx)
            FluentValidation.ValidatorOptions.CascadeMode = FluentValidation.CascadeMode.Continue; //if you need!

Viewing all articles
Browse latest Browse all 1917

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>