ValidationAttributeFormatterRegistry.AddFormatter<TAttribute> Methode

Definitie

Registreert een formatter factory voor het opgegeven type validatiekenmerk. Latere registraties voor hetzelfde type vervangen eerdere registraties.

public:
generic <typename TAttribute>
 where TAttribute : System::ComponentModel::DataAnnotations::ValidationAttribute void AddFormatter(Func<TAttribute, Microsoft::Extensions::Validation::Localization::IValidationAttributeFormatter ^> ^ factory);
public void AddFormatter<TAttribute>(Func<TAttribute,Microsoft.Extensions.Validation.Localization.IValidationAttributeFormatter> factory) where TAttribute : System.ComponentModel.DataAnnotations.ValidationAttribute;
member this.AddFormatter : Func<'Attribute, Microsoft.Extensions.Validation.Localization.IValidationAttributeFormatter (requires 'Attribute :> System.ComponentModel.DataAnnotations.ValidationAttribute)> -> unit (requires 'Attribute :> System.ComponentModel.DataAnnotations.ValidationAttribute)
Public Sub AddFormatter(Of TAttribute As ValidationAttribute) (factory As Func(Of TAttribute, IValidationAttributeFormatter))

Type parameters

TAttribute

Het type validatiekenmerk waarvoor een notatie moet worden geregistreerd.

Parameters

factory
Func<TAttribute,IValidationAttributeFormatter>

Een factory-gemachtigde die een IValidationAttributeFormatter van het kenmerkexemplaren maakt.

Opmerkingen

De configuratie is bedoeld om te worden uitgevoerd tijdens het opstarten van de toepassing. Het dempen van het register nadat de validatiepijplijn is begonnen met het verwerken van aanvragen, is niet thread-safe.

Van toepassing op