次の方法で共有


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.

Inheritance Hierarchy

System.Object
  System.Web.Http.Validation.ModelValidatorProvider
    System.Web.Http.Validation.Providers.AssociatedValidatorProvider
      System.Web.Http.Validation.Providers.DataAnnotationsModelValidatorProvider

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

Syntax

'Declaration
Public Class DataAnnotationsModelValidatorProvider _
    Inherits AssociatedValidatorProvider
'Usage
Dim instance As DataAnnotationsModelValidatorProvider
public class DataAnnotationsModelValidatorProvider : AssociatedValidatorProvider
public ref class DataAnnotationsModelValidatorProvider : public AssociatedValidatorProvider
type DataAnnotationsModelValidatorProvider =  
    class
        inherit AssociatedValidatorProvider
    end
public class DataAnnotationsModelValidatorProvider extends AssociatedValidatorProvider

The DataAnnotationsModelValidatorProvider type exposes the following members.

Constructors

  Name Description
Public method DataAnnotationsModelValidatorProvider Initializes a new instance of the DataAnnotationsModelValidatorProvider class.

Top

Methods

  Name Description
Public method Equals (Inherited from Object.)
Protected method Finalize (Inherited from Object.)
Public method GetHashCode (Inherited from Object.)
Public method GetType (Inherited from Object.)
Protected method GetTypeDescriptor Gets a type descriptor for the specified type. (Inherited from AssociatedValidatorProvider.)
Public method GetValidators(ModelMetadata, IEnumerable<ModelValidatorProvider>) Gets the validators for the model using the metadata and validator providers. (Inherited from AssociatedValidatorProvider.)
Protected method GetValidators(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 method MemberwiseClone (Inherited from Object.)
Public method RegisterAdapter Registers an adapter to provide client-side validation.
Public method RegisterAdapterFactory Registers an adapter factory for the validation provider.
Public method RegisterDefaultAdapter Registers the default adapter.
Public method RegisterDefaultAdapterFactory Registers the default adapter factory.
Public method RegisterDefaultValidatableObjectAdapter Registers 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 method RegisterDefaultValidatableObjectAdapterFactory Registers the default adapter factory for objects which implement IValidatableObject.
Public method RegisterValidatableObjectAdapter Registers 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 method RegisterValidatableObjectAdapterFactory Registers an adapter factory for the given modelType, which must implement IValidatableObject.
Public method ToString (Inherited from Object.)

Top

Thread Safety

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

See Also

Reference

System.Web.Http.Validation.Providers Namespace