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


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

Namespace:   System.ComponentModel.DataAnnotations
Assembly:  System.ComponentModel.DataAnnotations (in System.ComponentModel.DataAnnotations.dll)

public ValidationContext(
	object instance,
	IServiceProvider serviceProvider,
	IDictionary<object, object> items


Type: System.Object

The object to validate. This parameter is required.

Type: System.IServiceProvider

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

Type: System.Collections.Generic.IDictionary<Object, Object>

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

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.

Universal Windows Platform
Available since 10
.NET Framework
Available since 4.0
Available since 3.0
Return to top