DisplayNameInfo Class

Definition

Resolves the display name of a validated member (property, parameter, or type). Each ValidatablePropertyInfo, ValidatableParameterInfo, and ValidatableTypeInfo may carry a single DisplayNameInfo instance that encapsulates the strategy for producing its display name at validation time.

public ref class DisplayNameInfo abstract
[System.Diagnostics.CodeAnalysis.Experimental("ASP0029", UrlFormat="https://aka.ms/aspnet/analyzer/{0}")]
public abstract class DisplayNameInfo
[<System.Diagnostics.CodeAnalysis.Experimental("ASP0029", UrlFormat="https://aka.ms/aspnet/analyzer/{0}")>]
type DisplayNameInfo = class
Public MustInherit Class DisplayNameInfo
Inheritance
DisplayNameInfo
Attributes

Remarks

Implementations encode a single source of the display name (for example, a literal value from Name, a static resource accessor for [Display(ResourceType = ..., Name = ...)], or a custom strategy). The validation pipeline calls GetDisplayName(ValidateContext, String, Type) once per member validation and uses the result, falling back to the CLR member name when the implementation returns null.

Implementations may participate in localization by inspecting Localizer on ValidationOptions. Implementations that source their value from a static resource (the ResourceType path) typically bypass IValidationLocalizer because the resource lookup is the canonical source for the localized name.

Constructors

Name Description
DisplayNameInfo()

Methods

Name Description
GetDisplayName(ValidateContext, String, Type)

Resolves the display name to use when reporting validation errors for the member.

Applies to