IValidateOptions<T>
An interface for writing options validation rules in code, such as a rule comparing two members that no single attribute can express.
In more detail
Its Validate method returns ValidateOptionsResult.Success or Fail with messages. Register it as a singleton; ValidateOnStart runs it alongside the attributes.
Related terms
- ValidateOnStart — The options-builder call that makes the host validate options while starting and refuse to start if they are invalid.
- data annotations — Attributes from System.ComponentModel.DataAnnotations, such as [Required] and [Range(1, 200)], that declare simple validation rules on properties.
- named options — Several independently configured instances of the same options class, told apart by a name.
Taught in
- The Options Pattern: Strongly Typed Configuration — Modern .NET Core, C# & Enterprise Microservices