ValidationContext Constructors

Definitie

Initialiseert een nieuw exemplaar van de ValidationContext klasse.

Overloads

Name Description
ValidationContext(Object)

Initialiseert een nieuw exemplaar van de ValidationContext klasse met behulp van het opgegeven objectexemplaren.

ValidationContext(Object, IDictionary<Object,Object>)

Initialiseert een nieuw exemplaar van de ValidationContext klasse met behulp van het opgegeven object en een optionele eigenschapsverzameling.

ValidationContext(Object, IServiceProvider, IDictionary<Object,Object>)

Initialiseert een nieuw exemplaar van de ValidationContext klasse met behulp van de serviceprovider en woordenlijst van servicegebruikers.

ValidationContext(Object, String, IServiceProvider, IDictionary<Object,Object>)

Hiermee maakt u een ValidationContext voor een bepaald objectexemplaren met een displayName, een optionele serviceProvideren een optionele eigenschapszak van items.

ValidationContext(Object)

Bron:
ValidationContext.cs
Bron:
ValidationContext.cs
Bron:
ValidationContext.cs
Bron:
ValidationContext.cs
Bron:
ValidationContext.cs

Initialiseert een nieuw exemplaar van de ValidationContext klasse met behulp van het opgegeven objectexemplaren.

public:
 ValidationContext(System::Object ^ instance);
public ValidationContext(object instance);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Constructing a ValidationContext without a display name is not trim-safe because it uses reflection to discover the type of the instance being validated in order to resolve the DisplayNameAttribute when a display name is not provided.")]
public ValidationContext(object instance);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The Type of instance cannot be statically discovered.")]
public ValidationContext(object instance);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The Type of instance cannot be statically discovered and the Type's properties can be trimmed.")]
public ValidationContext(object instance);
new System.ComponentModel.DataAnnotations.ValidationContext : obj -> System.ComponentModel.DataAnnotations.ValidationContext
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Constructing a ValidationContext without a display name is not trim-safe because it uses reflection to discover the type of the instance being validated in order to resolve the DisplayNameAttribute when a display name is not provided.")>]
new System.ComponentModel.DataAnnotations.ValidationContext : obj -> System.ComponentModel.DataAnnotations.ValidationContext
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The Type of instance cannot be statically discovered.")>]
new System.ComponentModel.DataAnnotations.ValidationContext : obj -> System.ComponentModel.DataAnnotations.ValidationContext
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The Type of instance cannot be statically discovered and the Type's properties can be trimmed.")>]
new System.ComponentModel.DataAnnotations.ValidationContext : obj -> System.ComponentModel.DataAnnotations.ValidationContext
Public Sub New (instance As Object)

Parameters

instance
Object

Het objectexemplaren dat moet worden gevalideerd. Het kan niet worden null.

Kenmerken

Uitzonderingen

instance is null.

Van toepassing op

ValidationContext(Object, IDictionary<Object,Object>)

Bron:
ValidationContext.cs
Bron:
ValidationContext.cs
Bron:
ValidationContext.cs
Bron:
ValidationContext.cs
Bron:
ValidationContext.cs

Initialiseert een nieuw exemplaar van de ValidationContext klasse met behulp van het opgegeven object en een optionele eigenschapsverzameling.

public:
 ValidationContext(System::Object ^ instance, System::Collections::Generic::IDictionary<System::Object ^, System::Object ^> ^ items);
public ValidationContext(object instance, System.Collections.Generic.IDictionary<object,object> items);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Constructing a ValidationContext without a display name is not trim-safe because it uses reflection to discover the type of the instance being validated in order to resolve the DisplayNameAttribute when a display name is not provided.")]
public ValidationContext(object instance, System.Collections.Generic.IDictionary<object,object?>? items);
public ValidationContext(object instance, System.Collections.Generic.IDictionary<object,object?>? items);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The Type of instance cannot be statically discovered.")]
public ValidationContext(object instance, System.Collections.Generic.IDictionary<object,object?>? items);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The Type of instance cannot be statically discovered and the Type's properties can be trimmed.")]
public ValidationContext(object instance, System.Collections.Generic.IDictionary<object,object?>? items);
new System.ComponentModel.DataAnnotations.ValidationContext : obj * System.Collections.Generic.IDictionary<obj, obj> -> System.ComponentModel.DataAnnotations.ValidationContext
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Constructing a ValidationContext without a display name is not trim-safe because it uses reflection to discover the type of the instance being validated in order to resolve the DisplayNameAttribute when a display name is not provided.")>]
new System.ComponentModel.DataAnnotations.ValidationContext : obj * System.Collections.Generic.IDictionary<obj, obj> -> System.ComponentModel.DataAnnotations.ValidationContext
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The Type of instance cannot be statically discovered.")>]
new System.ComponentModel.DataAnnotations.ValidationContext : obj * System.Collections.Generic.IDictionary<obj, obj> -> System.ComponentModel.DataAnnotations.ValidationContext
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The Type of instance cannot be statically discovered and the Type's properties can be trimmed.")>]
new System.ComponentModel.DataAnnotations.ValidationContext : obj * System.Collections.Generic.IDictionary<obj, obj> -> System.ComponentModel.DataAnnotations.ValidationContext
Public Sub New (instance As Object, items As IDictionary(Of Object, Object))

Parameters

instance
Object

Het objectexemplaren dat moet worden gevalideerd. Het kan niet worden null.

items
IDictionary<Object,Object>

Een optionele set sleutel-waardeparen die beschikbaar moeten worden gesteld aan consumenten.

Kenmerken

Uitzonderingen

instance is null.

Opmerkingen

Als items dat het is null, wordt er een lege woordenlijst gemaakt. Als items dit niet null is, wordt de set sleutel-/waardeparen gekopieerd naar een nieuwe woordenlijst, waardoor gebruikers de oorspronkelijke woordenlijst niet kunnen wijzigen.

Van toepassing op

ValidationContext(Object, IServiceProvider, IDictionary<Object,Object>)

Bron:
ValidationContext.cs
Bron:
ValidationContext.cs
Bron:
ValidationContext.cs
Bron:
ValidationContext.cs
Bron:
ValidationContext.cs

Initialiseert een nieuw exemplaar van de ValidationContext klasse met behulp van de serviceprovider en woordenlijst van servicegebruikers.

public:
 ValidationContext(System::Object ^ instance, IServiceProvider ^ serviceProvider, System::Collections::Generic::IDictionary<System::Object ^, System::Object ^> ^ items);
public ValidationContext(object instance, IServiceProvider serviceProvider, System.Collections.Generic.IDictionary<object,object> items);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Constructing a ValidationContext without a display name is not trim-safe because it uses reflection to discover the type of the instance being validated in order to resolve the DisplayNameAttribute when a display name is not provided.")]
public ValidationContext(object instance, IServiceProvider? serviceProvider, System.Collections.Generic.IDictionary<object,object?>? items);
public ValidationContext(object instance, IServiceProvider? serviceProvider, System.Collections.Generic.IDictionary<object,object?>? items);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The Type of instance cannot be statically discovered.")]
public ValidationContext(object instance, IServiceProvider? serviceProvider, System.Collections.Generic.IDictionary<object,object?>? items);
[System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The Type of instance cannot be statically discovered and the Type's properties can be trimmed.")]
public ValidationContext(object instance, IServiceProvider? serviceProvider, System.Collections.Generic.IDictionary<object,object?>? items);
new System.ComponentModel.DataAnnotations.ValidationContext : obj * IServiceProvider * System.Collections.Generic.IDictionary<obj, obj> -> System.ComponentModel.DataAnnotations.ValidationContext
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("Constructing a ValidationContext without a display name is not trim-safe because it uses reflection to discover the type of the instance being validated in order to resolve the DisplayNameAttribute when a display name is not provided.")>]
new System.ComponentModel.DataAnnotations.ValidationContext : obj * IServiceProvider * System.Collections.Generic.IDictionary<obj, obj> -> System.ComponentModel.DataAnnotations.ValidationContext
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The Type of instance cannot be statically discovered.")>]
new System.ComponentModel.DataAnnotations.ValidationContext : obj * IServiceProvider * System.Collections.Generic.IDictionary<obj, obj> -> System.ComponentModel.DataAnnotations.ValidationContext
[<System.Diagnostics.CodeAnalysis.RequiresUnreferencedCode("The Type of instance cannot be statically discovered and the Type's properties can be trimmed.")>]
new System.ComponentModel.DataAnnotations.ValidationContext : obj * IServiceProvider * System.Collections.Generic.IDictionary<obj, obj> -> System.ComponentModel.DataAnnotations.ValidationContext
Public Sub New (instance As Object, serviceProvider As IServiceProvider, items As IDictionary(Of Object, Object))

Parameters

instance
Object

Het object dat moet worden gevalideerd. Deze parameter is vereist.

serviceProvider
IServiceProvider

Het object dat de IServiceProvider interface implementeert. Deze parameter is optioneel.

items
IDictionary<Object,Object>

Een woordenlijst van sleutel-waardeparen die beschikbaar moeten worden gesteld aan de servicegebruikers. Deze parameter is optioneel.

Kenmerken

Uitzonderingen

instance is null.

Opmerkingen

De serviceProvider parameter vertegenwoordigt een service die door de GetService methode kan worden gebruikt om aangepaste validatie uit te voeren.

Als de items parameter is null, wordt er een lege woordenlijst gemaakt. Als de parameter niet nullis, wordt de set sleutel-/waardeparen gekopieerd naar een nieuwe woordenlijst, waardoor de servicegebruikers de oorspronkelijke woordenlijst niet kunnen wijzigen.

Van toepassing op

ValidationContext(Object, String, IServiceProvider, IDictionary<Object,Object>)

Bron:
ValidationContext.cs
Bron:
ValidationContext.cs

Hiermee maakt u een ValidationContext voor een bepaald objectexemplaren met een displayName, een optionele serviceProvideren een optionele eigenschapszak van items.

public:
 ValidationContext(System::Object ^ instance, System::String ^ displayName, IServiceProvider ^ serviceProvider, System::Collections::Generic::IDictionary<System::Object ^, System::Object ^> ^ items);
public ValidationContext(object instance, string displayName, IServiceProvider? serviceProvider, System.Collections.Generic.IDictionary<object,object?>? items);
new System.ComponentModel.DataAnnotations.ValidationContext : obj * string * IServiceProvider * System.Collections.Generic.IDictionary<obj, obj> -> System.ComponentModel.DataAnnotations.ValidationContext
Public Sub New (instance As Object, displayName As String, serviceProvider As IServiceProvider, items As IDictionary(Of Object, Object))

Parameters

instance
Object

Het objectexemplaren dat wordt gevalideerd. Het kan niet worden null.

displayName
String

De weergavenaam die is gekoppeld aan het objectexemplaar.

serviceProvider
IServiceProvider

Optioneel IServiceProvider om te gebruiken wanneer GetService(Type) wordt aangeroepen.

Als dat het is null, GetService(Type) zal altijd terugkeren null.

items
IDictionary<Object,Object>

Optionele set sleutel-waardeparen die beschikbaar moeten worden gesteld aan consumenten via Items.

Als nuller een lege woordenlijst wordt gemaakt. Zo niet null, wordt de set sleutel-/waardeparen gekopieerd naar een nieuwe woordenlijst, waardoor gebruikers de oorspronkelijke woordenlijst niet kunnen wijzigen.

Uitzonderingen

Wanneer instance is null

Opmerkingen

Deze constructor is trim-safe omdat er geen weerspiegeling wordt gebruikt om het type van de instance functie om te zetten ter ondersteuning van het instellen van de DisplayName.

Van toepassing op