ValidationAttributeFormatterRegistry.AddFormatter<TAttribute> Methode
Definition
Wichtig
Einige Informationen beziehen sich auf Vorabversionen, die vor dem Release ggf. grundlegend überarbeitet werden. Microsoft übernimmt hinsichtlich der hier bereitgestellten Informationen keine Gewährleistungen, seien sie ausdrücklich oder konkludent.
Registriert eine Formatiererfactory für den angegebenen Überprüfungsattributtyp. Spätere Registrierungen für denselben Typ ersetzen frühere.
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))
Typparameter
- TAttribute
Der Überprüfungsattributtyp, für den ein Formatierer registriert werden soll.
Parameter
- factory
- Func<TAttribute,IValidationAttributeFormatter>
Ein Factorydelegat, der eine IValidationAttributeFormatter aus der Attributinstanz erstellt.
Hinweise
Die Konfiguration soll während des Anwendungsstarts erfolgen. Das Stummschalten der Registrierung, nachdem die Überprüfungspipeline mit der Verarbeitung von Anforderungen begonnen hat, ist nicht threadsicher.