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