Export (0) Print
Expand All

ValidationContext Class

Describes the context in which a validation check is performed.

System.Object
  System.ComponentModel.DataAnnotations.ValidationContext

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

public sealed class ValidationContext : IServiceProvider

The ValidationContext type exposes the following members.

  NameDescription
Public methodSupported by Portable Class LibrarySupported in .NET for Windows Store appsValidationContext(Object)Initializes a new instance of the ValidationContext class using the specified object instance
Public methodSupported by Portable Class LibrarySupported in .NET for Windows Store appsValidationContext(Object, IDictionary<Object, Object>)Initializes a new instance of the ValidationContext class using the specified object and an optional property bag.
Public methodValidationContext(Object, IServiceProvider, IDictionary<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 LibrarySupported in .NET for Windows Store appsDisplayNameGets or sets the name of the member to validate.
Public propertySupported by Portable Class LibrarySupported in .NET for Windows Store appsItemsGets the dictionary of key/value pairs that is associated with this context.
Public propertySupported by Portable Class LibrarySupported in .NET for Windows Store appsMemberNameGets or sets the name of the member to validate.
Public propertySupported by Portable Class LibrarySupported in .NET for Windows Store appsObjectInstanceGets the object to validate.
Public propertySupported by Portable Class LibrarySupported in .NET for Windows Store appsObjectTypeGets the type of the object to validate.
Public propertyServiceContainerGets the validation services container.
Top

  NameDescription
Public methodSupported by Portable Class LibrarySupported in .NET for Windows Store appsEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Public methodSupported by Portable Class LibrarySupported in .NET for Windows Store appsGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodSupported by Portable Class LibrarySupported in .NET for Windows Store appsGetServiceReturns the service that provides custom validation.
Public methodSupported by Portable Class LibrarySupported in .NET for Windows Store appsGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodSupported by Portable Class LibrarySupported in .NET for Windows Store appsInitializeServiceProviderInitializes the ValidationContext using a service provider that can return service instances by type when GetService is called.
Public methodSupported by Portable Class LibrarySupported in .NET for Windows Store appsToStringReturns 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.5, 4

.NET Framework Client Profile

Supported in: 4

Portable Class Library

Supported in: Portable Class Library

.NET for Windows Store apps

Supported in: Windows 8

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

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

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