Export (0) Print
Expand All

ValidationContext Class

Provides information about a type or member to validate.

System.Object
  System.ComponentModel.DataAnnotations.ValidationContext

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

'Declaration
Public NotInheritable Class ValidationContext _
	Implements IServiceProvider

The ValidationContext type exposes the following members.

  NameDescription
Public methodValidationContext(Object)Initializes a new instance of the ValidationContext class with the specified object to validate.
Public methodValidationContext(Object, IDictionary(Of Object, Object))Initializes a new instance of the ValidationContext class with the specified object to validate and a collection of values related to validation.
Public methodValidationContext(Object, IServiceProvider, IDictionary(Of Object, Object))Initializes a new instance of the ValidationContext class with the specified object to validate, a service provider that enables validation methods to access external services, and a collection of values related to validation.
Top

  NameDescription
Public propertyDisplayNameGets or sets the name to display to users for the member to validate.
Public propertyItemsGets the collection of values associated with the validation request.
Public propertyMemberNameGets or sets the programmatic name of the member to validate.
Public propertyObjectInstanceGets the object to validate.
Public propertyObjectTypeGets the type of the object to validate.
Top

  NameDescription
Public methodEquals(Object)Determines whether the specified Object is equal to the current Object. (Inherited from Object.)
Protected methodFinalizeAllows an object to try to free resources and perform other cleanup operations before the Object is reclaimed by garbage collection. (Inherited from Object.)
Public methodGetHashCodeServes as a hash function for a particular type. (Inherited from Object.)
Public methodGetServiceRetrieves an instance of the service to use during validation.
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodInitializeServiceProviderInitializes the ValidationContext with a service provider that can return service instances of the specified type when the GetService method is called.
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Public methodToStringReturns a string that represents the current object. (Inherited from Object.)
Top

The ValidationContext class describes the type or member on which validation is performed. It also enables validation routines to reference services that are available through the GetService method of the IServiceProvider interface.

Silverlight

Supported in: 5, 4, 3

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Community Additions

ADD
Show:
© 2014 Microsoft