ASP.NET Core: Performing the Model Validations in ASP.NET Core using Action Filters
In this article, we will see how we can validate the model data in ASP.NET Core API. In ASP.NET Core Actions filters allows code to run before or after specific stages in the request processing pipeline. There build-in filters provided in ASP.NET Core for Authorization, Resources, Exception, etc. We can create the Custom filters those are used to handle cross-cutting concerns. For example, custom error handling, caching, configuration, authorization, and logging. Action Filters are used to avoid duplicating code. Data Validation is the most important and mandatory part of the application development. This prevents the invalid data to be accepted and processed by the application system. In ASP.NET Core, we have data annotations to validate Model properties. We can apply data annotations on Model properties if we have access to Model classes, but what if we do not have access to it, in this case we need to implement validations using Fluent Validation techniques. In .NET Core we hav