The Best Way To Validate Your Options In .NET Core

Published: 01 January 1970
on channel: Milan Jovanović
11,924
584

☄️ 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:   / milanjovanovic  

The Options pattern allows us to use classes to provide strongly typed configuration values in our application at runtime. But you have no guarantee that the configuration values injected with IOptions will be correctly read from the application settings. In this video, I will show you how to introduce validation to your IOptions and ensure the application settings are correct. You will also see how to verify that the options are correctly configured at the application start.

Adding Validation To The Options Pattern In ASP.NET Core
https://www.milanjovanovic.tech/blog/...

How To Use The Options Pattern In ASP.NET Core 7:
https://www.milanjovanovic.tech/blog/...

Join my weekly .NET newsletter:
https://www.milanjovanovic.tech

Read my Blog here:
https://www.milanjovanovic.tech/blog

Subscribe for more:
   / @milanjovanovictech  

Chapters
0:00 Configuring the Options pattern
1:40 Checking the setting's value
2:27 What could go wrong?
3:05 Adding validation with Data Annotations
3:35 Configuring the Options pattern for validation
5:20 Validating options at application start
6:42 Adding custom validation rules


Watch video The Best Way To Validate Your Options In .NET Core online, duration hours minute second in high quality that is uploaded to the channel Milan Jovanović 01 January 1970. Share the link to the video on social media so that your subscribers and friends will also watch this video. This video clip has been viewed 11,924 times and liked it 584 visitors.