ערוך

שתף באמצעות


ValidationContext Constructors

Definition

Initializes a new instance of the ValidationContext class.

Overloads

ValidationContext(Object)

Initializes a new instance of the ValidationContext class using the specified object instance.

ValidationContext(Object, IDictionary<Object,Object>)

Initializes a new instance of the ValidationContext class using the specified object and an optional property bag.

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

Initializes a new instance of the ValidationContext class using the service provider and dictionary of service consumers.

ValidationContext(Object)

Source:
ValidationContext.cs
Source:
ValidationContext.cs
Source:
ValidationContext.cs

Initializes a new instance of the ValidationContext class using the specified object instance.

public:
 ValidationContext(System::Object ^ instance);
public ValidationContext (object instance);
new System.ComponentModel.DataAnnotations.ValidationContext : obj -> System.ComponentModel.DataAnnotations.ValidationContext
Public Sub New (instance As Object)

Parameters

instance
Object

The object instance to validate. It cannot be null.

Exceptions

instance is null.

Applies to

ValidationContext(Object, IDictionary<Object,Object>)

Source:
ValidationContext.cs
Source:
ValidationContext.cs
Source:
ValidationContext.cs

Initializes a new instance of the ValidationContext class using the specified object and an optional property bag.

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);
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
Public Sub New (instance As Object, items As IDictionary(Of Object, Object))

Parameters

instance
Object

The object instance to validate. It cannot be null.

items
IDictionary<Object,Object>

An optional set of key/value pairs to make available to consumers.

Exceptions

instance is null.

Remarks

If items is null, an empty dictionary is created. If items is not null, the set of key/value pairs is copied into a new dictionary, preventing consumers from modifying the original dictionary.

Applies to

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

Source:
ValidationContext.cs
Source:
ValidationContext.cs
Source:
ValidationContext.cs

Initializes a new instance of the ValidationContext class using the service provider and dictionary of service consumers.

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);
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
Public Sub New (instance As Object, serviceProvider As IServiceProvider, items As IDictionary(Of Object, Object))

Parameters

instance
Object

The object to validate. This parameter is required.

serviceProvider
IServiceProvider

The object that implements the IServiceProvider interface. This parameter is optional.

items
IDictionary<Object,Object>

A dictionary of key/value pairs to make available to the service consumers. This parameter is optional.

Exceptions

instance is null.

Remarks

The serviceProvider parameter represents a service that can be used by the GetService method in order to perform custom validation.

If the items parameter is null, an empty dictionary is created. If the parameter is not null, the set of key/value pairs is copied into a new dictionary, which prevents the service consumers from modifying the original dictionary.

Applies to