編輯

共用方式為


DataAnnotationsModelValidator<TAttribute> Class

Definition

Provides a model validator for a specified validation type.

generic <typename TAttribute>
 where TAttribute : ValidationAttributepublic ref class DataAnnotationsModelValidator : System::Web::ModelBinding::DataAnnotationsModelValidator
public class DataAnnotationsModelValidator<TAttribute> : System.Web.ModelBinding.DataAnnotationsModelValidator where TAttribute : ValidationAttribute
type DataAnnotationsModelValidator<'Attribute (requires 'Attribute :> ValidationAttribute)> = class
    inherit DataAnnotationsModelValidator
Public Class DataAnnotationsModelValidator(Of TAttribute)
Inherits DataAnnotationsModelValidator

Type Parameters

TAttribute

The type of the validation attribute.

Inheritance
DataAnnotationsModelValidator<TAttribute>
Derived

Constructors

DataAnnotationsModelValidator<TAttribute>(ModelMetadata, ModelBindingExecutionContext, TAttribute)

Initializes a new instance of the DataAnnotationsModelValidator<TAttribute> class.

Properties

Attribute

Gets the validation attribute.

ErrorMessage

Gets the error message for a validation failure.

(Inherited from DataAnnotationsModelValidator)
IsRequired

Gets a value that indicates whether the model is required (that is, whether the validation attribute in the Attribute property is a RequiredAttribute attribute).

(Inherited from DataAnnotationsModelValidator)
Metadata

When implemented in a derived class, gets the metadata for the model validator.

(Inherited from ModelValidator)
ModelBindingExecutionContext

When implemented in a derived class, gets the execution context.

(Inherited from ModelValidator)

Methods

Equals(Object)

Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode()

Serves as the default hash function.

(Inherited from Object)
GetLocalizedErrorMessage(String)

Gets a localized error message for the model.

(Inherited from DataAnnotationsModelValidator)
GetLocalizedString(String, Object[])

Gets a localized version for a specific string.

(Inherited from DataAnnotationsModelValidator)
GetType()

Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone()

Creates a shallow copy of the current Object.

(Inherited from Object)
ToString()

Returns a string that represents the current object.

(Inherited from Object)
Validate(Object)

Returns a list of validation error messages for the model.

(Inherited from DataAnnotationsModelValidator)

Applies to