Friday, September 30, 2016

Using FluentValidation for ASP.NET Web API

If you want to implement validation for your ASP.NET MVC Web Application, this is easily done in a number of ways using ASP.NET MVC's own validation mechanisms as well as using NuGet packages such as FluentValidation for ASP.NET MVC: https://github.com/JeremySkinner/FluentValidation

Unfortunately, even though there is also a FluentValidation NuGet package for ASP.NET Web API (https://www.nuget.org/packages/FluentValidation.WebAPI/), there is no corresponding documentation for ASP.NET Web API on the FluentValidation Wiki!(https://github.com/JeremySkinner/FluentValidation/wiki)

Thankfully, though, there are a few articles which address just how to accomplish this using the FluentValidation library for ASP.NET Web API!

http://www.justinsaraceno.com/2014/07/fluentvalidation-with-webapi2/

https://www.exceptionnotfound.net/custom-validation-in-asp-net-web-api-with-fluentvalidation/



1 comment: