Run ASP.NET Core default validation first
See original GitHub issueSystem Details
- FluentValidation version: 8.0.100
- Web Framework version (eg ASP.NET Core 2.1, MVC 5, WebApi 2. Delete if not applicable): ASP.NET Core 2.1
Issue Description
What I am looking for is basically exact opposite of :
.AddFluentValidation(fv =>
{
fv.RunDefaultMvcValidationAfterFluentValidationExecutes = true;
})
Basically, trying to run the default data annotation validations before fluent validation validators
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Model validation in ASP.NET Core MVC and Razor Pages
Model validation occurs after model binding and reports errors where data doesn't conform to business rules. For example, a 0 is entered in...
Read more >ASP.NET Core MVC Model Validation
In Asp.Net Core, Model state always return validation errors in a normal HTML format in the interface. This will continue the validation process ......
Read more >Validation of ASP.NET Core options during startup
There are easy way to validating with using IStartupFilter and IValidateOptions . You can just put below code your ASP.NET Core project. And ......
Read more >Model Validation in ASP.NET Core [Beginner to Expert]
Model Validation is a technique to provide rules for model properties and validating these rules so that they are not broken. When rules...
Read more >How to Use ModelState Validation in ASP.NET Core Web API
In this article, we are going to talk how to use ModelState validation. Also we are going to see manual and automatic validation....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
DataAnnotations tends to mess with FluentValidation if it runs first, as if DataAnnotations encounters a validation failure then it will not allow FV to add any errors for the same property (or this certainly used to be the case). This is usually undesirable, which is why FV should typically run first. I don’t really feel there’s a need to make it configurable as it’s easy enough to swap them around in an
AddMvcOptions
call if you really want to do it.The ModelValidatorProviders collection is part of MVC - take a look at the AddMvcOptions method that allows you to customise the MVC bootstrapping process: