This documentation is archived and is not being maintained.

ValidationContext Constructor

Initializes a new instance of the ValidationContext class.

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

public ValidationContext(
	Object instance,
	IServiceProvider serviceProvider,
	IDictionary<Object, Object> items
)

Parameters

instance
Type: System.Object
The object to validate. This parameter is required.
serviceProvider
Type: System.IServiceProvider
The object that implements the IServiceProvider interface. This parameter is optional.
items
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.

.NET Framework

Supported in: 4

.NET Framework Client Profile

Supported in: 4

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Show: