This video will show you how to start building advanced ASP.NET Core model validation rules using the powerful (but easy to use) FluentValidation library.
0:00 Introduction
0:27 The Model We Want to Validate
2:00 FluentValidation installation
2:20 Creating the Validator
5:00 Conditional Validation (When)
7:25 List Validators (RuleForEach)
8:50 Registering FluentValidation with MVC
10:30 Testing in Postman
12:10 Inspecting the Final Request
12:40 Outro
13:00 Peng Music
The FluentValidation library makes custom model validation really simple and flexible with a powerful fluent API. This video shows you how to use FluentValidation to validate a POCO model class and override the built in validation middleware.
This example uses a Web API project, but implementation is very similar for MVC.
Example code from the video:
https://github.com/chrismroberts/aspn...
FluentValidation documentation:
https://docs.fluentvalidation.net/en/...
FluentValidation on GitHub:
https://github.com/FluentValidation/F...
I'm Chris Roberts, a freelance software engineer based in the UK:
https://chrismroberts.com/
Our gear - click through to support our channel! :)
Camera (Canon M50)
UK: https://amzn.to/3sUbzuL
US: https://amzn.to/3uBsG5c
Camera mic (RODE VideoMic Pro)
UK: https://amzn.to/3ml8xgC
US: https://amzn.to/2RkGxyi
Camera tripod (Manfrotto Compact tripod):
UK: https://amzn.to/3fJGyWU
US: https://amzn.to/3mF4oV2
Voiceover Mic (Blue Yeti)
UK: https://amzn.to/2PV7UOQ
US: https://amzn.to/3uMiEym
Chris's dev mouse for PC (Logitech MX Master 3)
UK: https://amzn.to/39K7BNV
US: https://amzn.to/3uKYvso
Chris's dev keyboard for PC (Logitech MX Keys)
UK: https://amzn.to/3rSbHcX
US: https://amzn.to/3a6Unef
Rob's dev keyboard for Mac (Apple Magic Keyboard)
UK: https://amzn.to/3dEQpKG
US: https://amzn.to/3sb6JZc
Rob's dev mouse for Mac (Apple Magic Mouse)
UK: https://amzn.to/3sRCQhr
US: https://amzn.to/3mFi6qS