ValidationContext Class

Describes the context in which a validation check is performed.

System.Object
  System.ComponentModel.DataAnnotations.ValidationContext

Namespace:  System.ComponentModel.DataAnnotations
Assemblies:   System.ComponentModel.Annotations (in System.ComponentModel.Annotations.dll)
  System.ComponentModel.DataAnnotations (in System.ComponentModel.DataAnnotations.dll)

'Declaration
Public NotInheritable Class ValidationContext _
	Implements IServiceProvider

The ValidationContext type exposes the following members.

  NameDescription
Public methodSupported by Portable Class LibraryValidationContext(Object)Initializes a new instance of the ValidationContext class using the specified object instance
Public methodSupported by Portable Class LibraryValidationContext(Object, IDictionary(Of Object, Object))Initializes a new instance of the ValidationContext class using the specified object and an optional property bag.
Public methodValidationContext(Object, IServiceProvider, IDictionary(Of Object, Object))Initializes a new instance of the ValidationContext class using the service provider and dictionary of service consumers.
Top

  NameDescription
Public propertySupported by Portable Class LibraryDisplayNameGets or sets the name of the member to validate.
Public propertySupported by Portable Class LibraryItemsGets the dictionary of key/value pairs that is associated with this context.
Public propertySupported by Portable Class LibraryMemberNameGets or sets the name of the member to validate.
Public propertySupported by Portable Class LibraryObjectInstanceGets the object to validate.
Public propertySupported by Portable Class LibraryObjectTypeGets the type of the object to validate.
Public propertyServiceContainerGets the validation services container.
Top

  NameDescription
Public methodSupported by Portable Class LibraryEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Public methodSupported by Portable Class LibraryGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodSupported by Portable Class LibraryGetServiceReturns the service that provides custom validation.
Public methodSupported by Portable Class LibraryGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodSupported by Portable Class LibraryInitializeServiceProviderInitializes the ValidationContext using a service provider that can return service instances by type when GetService is called.
Public methodSupported by Portable Class LibraryToStringReturns a string that represents the current object. (Inherited from Object.)
Top

This class describes the type or member on which validation is performed. It also enables custom validation to be added through any service that implements the IServiceProvider interface.

.NET Framework

Supported in: 4.6, 4.5, 4

.NET Framework Client Profile

Supported in: 4

Portable Class Library

Supported in: Portable Class Library

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2015 Microsoft