Back to Browse

Easily Validate the Options Pattern with FluentValidation

15.1K views
Oct 13, 2023
15:40

☄️ Master the Modular Monolith Architecture: https://bit.ly/3SXlzSt 📌 Accelerate your Clean Architecture skills: https://bit.ly/3PupkOJ 🚀 Support me on Patreon to access the source code: https://www.patreon.com/milanjovanovic The options pattern creates strongly typed settings classes in .NET. It's important to validate the options pattern to ensure your configuration values are correctly set. You can do it with data annotations, although this approach isn't flexible. A better solution is to use FluentValidation, and I'll show you how in this video. Join my weekly .NET newsletter: - https://www.milanjovanovic.tech Read my Blog here: - https://www.milanjovanovic.tech/blog Adding validation to strongly typed configuration objects using FluentValidation: - https://andrewlock.net/adding-validation-to-strongly-typed-configuration-objects-using-flentvalidation Chapters 0:00 Validating options pattern with Data Annotations 2:58 Registering FluentValidation with dependency injection 3:58 Creating the validator using FluentValidation 6:54 Implementing IValidateOptions using FluentValidation 11:08 Adding extension method to register the validator 13:30 Simplifying everything with another extension method

Download

0 formats

No download links available.

Easily Validate the Options Pattern with FluentValidation | NatokHD