ValidationContext Konstruktorer

Definition

Initierar en ny instans av ValidationContext klassen.

Överlagringar

Name Description
ValidationContext(Object)

Initierar en ny instans av ValidationContext klassen med den angivna objektinstansen.

ValidationContext(Object, IDictionary<Object,Object>)

Initierar en ny instans av ValidationContext klassen med det angivna objektet och en valfri egenskapsväska.

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

Initierar en ny instans av klassen med hjälp av ValidationContext tjänstleverantören och ordlistan för tjänstkonsumenter.

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

Konstruerar en ValidationContext för en angiven objektinstans med en displayName, en valfri serviceProvideroch en valfri egenskapspåse med items.

ValidationContext(Object)

Källa:
ValidationContext.cs
Källa:
ValidationContext.cs
Källa:
ValidationContext.cs
Källa:
ValidationContext.cs
Källa:
ValidationContext.cs

Initierar en ny instans av ValidationContext klassen med den angivna objektinstansen.

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)

Parametrar

instance
Object

Objektinstansen som ska verifieras. Det kan inte vara null.

Attribut

Undantag

instance är null.

Gäller för

ValidationContext(Object, IDictionary<Object,Object>)

Källa:
ValidationContext.cs
Källa:
ValidationContext.cs
Källa:
ValidationContext.cs
Källa:
ValidationContext.cs
Källa:
ValidationContext.cs

Initierar en ny instans av ValidationContext klassen med det angivna objektet och en valfri egenskapsväska.

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))

Parametrar

instance
Object

Objektinstansen som ska verifieras. Det kan inte vara null.

items
IDictionary<Object,Object>

En valfri uppsättning nyckel/värde-par som ska vara tillgängliga för konsumenter.

Attribut

Undantag

instance är null.

Kommentarer

Om items är nullskapas en tom ordlista. Om items inte är null kopieras uppsättningen nyckel/värde-par till en ny ordlista, vilket hindrar konsumenter från att ändra den ursprungliga ordlistan.

Gäller för

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

Källa:
ValidationContext.cs
Källa:
ValidationContext.cs
Källa:
ValidationContext.cs
Källa:
ValidationContext.cs
Källa:
ValidationContext.cs

Initierar en ny instans av klassen med hjälp av ValidationContext tjänstleverantören och ordlistan för tjänstkonsumenter.

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))

Parametrar

instance
Object

Objektet som ska verifieras. Den här parametern krävs.

serviceProvider
IServiceProvider

Objektet som implementerar IServiceProvider gränssnittet. Den här parametern är valfri.

items
IDictionary<Object,Object>

En ordlista med nyckel-/värdepar som ska vara tillgängliga för tjänstkonsumenterna. Den här parametern är valfri.

Attribut

Undantag

instance är null.

Kommentarer

Parametern serviceProvider representerar en tjänst som kan användas av GetService metoden för att utföra anpassad validering.

Om parametern items är nullskapas en tom ordlista. Om parametern inte nullär kopieras uppsättningen nyckel/värde-par till en ny ordlista, vilket hindrar tjänstkonsumenterna från att ändra den ursprungliga ordlistan.

Gäller för

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

Källa:
ValidationContext.cs
Källa:
ValidationContext.cs

Konstruerar en ValidationContext för en angiven objektinstans med en displayName, en valfri serviceProvideroch en valfri egenskapspåse med 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))

Parametrar

instance
Object

Objektinstansen som verifieras. Det kan inte vara null.

displayName
String

Visningsnamnet som är associerat med objektinstansen.

serviceProvider
IServiceProvider

Valfritt IServiceProvider att använda när GetService(Type) anropas.

Om det är nullreturnerar GetService(Type)nullalltid .

items
IDictionary<Object,Object>

Valfri uppsättning nyckel/värde-par för att göra tillgängliga för konsumenter via Items.

Om nullskapas en tom ordlista. Om inte nullkopieras uppsättningen nyckel/värde-par till en ny ordlista, vilket hindrar konsumenter från att ändra den ursprungliga ordlistan.

Undantag

När instance är null

Kommentarer

Den här konstruktorn är trimsäker eftersom den inte använder reflektion för att matcha typen av instance som stöder inställningen DisplayName.

Gäller för