Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
ValidationContext Constructor (Object, IServiceProvider, IDictionary(Object, Object))

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
Assemblies:   System.ComponentModel.Annotations (in System.ComponentModel.Annotations.dll)
  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.6, 4.5, 4

.NET Framework Client Profile

Supported in: 4
Show:
© 2015 Microsoft