ValidateDataAnnotations
The options-builder call that checks a bound options object against the data annotation attributes on its properties.
In more detail
It turns attributes such as [Required] and [Range] into real checks on the bound options. Without ValidateOnStart, it runs only when the options are first used.
Related terms
- data annotations — Attributes from System.ComponentModel.DataAnnotations, such as [Required] and [Range(1, 200)], that declare simple validation rules on properties.
- ValidateOnStart — The options-builder call that makes the host validate options while starting and refuse to start if they are invalid.
- AddOptions — The registration call, services.AddOptions<T>(), that returns an options builder on which binding and validation calls are chained.
Taught in
- The Options Pattern: Strongly Typed Configuration — Modern .NET Core, C# & Enterprise Microservices