Export (0) Print
Expand All

DataAnnotationsModelValidatorProvider Class

Represents an implementation of ModelValidatorProvider which providers validators for attributes which derive from ValidationAttribute. It also provides a validator for types which implement IValidatableObject. To support client side validation, you can either register adapters through the static methods on this class, or by having your validation attributes implement IClientValidatable. The logic to support IClientValidatable is implemented in DataAnnotationsModelValidator.

Namespace:  System.Web.Http.Validation.Providers
Assembly:  System.Web.Http (in System.Web.Http.dll)

public class DataAnnotationsModelValidatorProvider : AssociatedValidatorProvider

The DataAnnotationsModelValidatorProvider type exposes the following members.

  NameDescription
Public methodDataAnnotationsModelValidatorProviderInitializes a new instance of the DataAnnotationsModelValidatorProvider class.
Top

  NameDescription
Public methodEquals (Inherited from Object.)
Protected methodFinalize (Inherited from Object.)
Public methodGetHashCode (Inherited from Object.)
Public methodGetType (Inherited from Object.)
Protected methodGetTypeDescriptorGets a type descriptor for the specified type. (Inherited from AssociatedValidatorProvider.)
Public methodGetValidators(ModelMetadata, IEnumerable<ModelValidatorProvider>)Gets the validators for the model using the metadata and validator providers. (Inherited from AssociatedValidatorProvider.)
Protected methodGetValidators(ModelMetadata, IEnumerable<ModelValidatorProvider>, IEnumerable<Attribute>)Gets the validators for the model using the specified metadata, validator provider and attributes. (Overrides AssociatedValidatorProvider.GetValidators(ModelMetadata, IEnumerable<ModelValidatorProvider>, IEnumerable<Attribute>).)
Protected methodMemberwiseClone (Inherited from Object.)
Public methodRegisterAdapterRegisters an adapter to provide client-side validation.
Public methodRegisterAdapterFactoryRegisters an adapter factory for the validation provider.
Public methodRegisterDefaultAdapterRegisters the default adapter.
Public methodRegisterDefaultAdapterFactoryRegisters the default adapter factory.
Public methodRegisterDefaultValidatableObjectAdapterRegisters the default adapter type for objects which implement IValidatableObject. The adapter type must derive from ModelValidator and it must contain a public constructor which takes two parameters of types ModelMetadata and HttpActionContext.
Public methodRegisterDefaultValidatableObjectAdapterFactoryRegisters the default adapter factory for objects which implement IValidatableObject.
Public methodRegisterValidatableObjectAdapterRegisters an adapter type for the given modelType, which must implement IValidatableObject. The adapter type must derive from ModelValidator and it must contain a public constructor which takes two parameters of types ModelMetadata and HttpActionContext.
Public methodRegisterValidatableObjectAdapterFactoryRegisters an adapter factory for the given modelType, which must implement IValidatableObject.
Public methodToString (Inherited from Object.)
Top

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