ValidationLocalizationOptions Class

Definition

Configuration options for the Microsoft.Extensions.Validation.Localization default IStringLocalizer-based validation localizer. Configure via services.AddValidationLocalization(options => ...).

public ref class ValidationLocalizationOptions
public class ValidationLocalizationOptions
type ValidationLocalizationOptions = class
Public Class ValidationLocalizationOptions
Inheritance
ValidationLocalizationOptions

Constructors

Name Description
ValidationLocalizationOptions()

Properties

Name Description
AttributeFormatters

Gets the registry of formatters for attribute-specific error message template formatting. Built-in formatters for standard attributes are registered automatically.

ErrorMessageKeyProvider

Gets or sets the delegate that determines the localization lookup key for a validation attribute's error message. When configured, the delegate is invoked for every attribute and takes precedence over ErrorMessage. Returning null or an empty string defers to using ErrorMessage directly as the lookup key.

LocalizerProvider

Gets or sets the delegate that controls which IStringLocalizer is used for a given declaring type. The declaring type is the type that contains the property being validated, or null when the validation pipeline has no declaring type to attribute the message to (e.g., top-level Minimal API parameters).

Applies to