ValidationMessageKeyContext Class

Definition

Provides contextual information used to compute the resource key for looking up a localized validation error message.

public ref class ValidationMessageKeyContext sealed
public sealed class ValidationMessageKeyContext
type ValidationMessageKeyContext = class
Public NotInheritable Class ValidationMessageKeyContext
Inheritance
ValidationMessageKeyContext

Remarks

An instance is passed to MessageKeyProvider when a custom key convention is configured. The returned key is then resolved against the configured IStringLocalizer.

Constructors

Name Description
ValidationMessageKeyContext()

Properties

Name Description
DeclaringType

Gets the type associated with the member being validated: the containing type for a property, the validated type itself for type-level validation, or the parameter's own type for a parameter.

MemberName

Gets the name of the member being validated: the property name for property validation, the parameter name for parameter validation, or the type name for type-level validation.

ValidatorType

Gets the type of the validator that produced the error being localized. For DataAnnotations, this is the validation attribute type (for example, typeof(RequiredAttribute)).

Applies to