DataAnnotationsModelValidator<TAttribute> 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
为指定的验证类型提供模型验证程序。
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
类型参数
- TAttribute
验证属性的类型。
- 继承
- 派生
构造函数
| 名称 | 说明 |
|---|---|
| DataAnnotationsModelValidator<TAttribute>(ModelMetadata, ModelBindingExecutionContext, TAttribute) |
初始化 DataAnnotationsModelValidator<TAttribute> 类的新实例。 |
属性
| 名称 | 说明 |
|---|---|
| Attribute |
获取验证属性。 |
| ErrorMessage |
获取验证失败的错误消息。 (继承自 DataAnnotationsModelValidator) |
| IsRequired |
获取一个值,该值指示是否需要模型(即属性中的 Attribute 验证属性是否为 RequiredAttribute 属性)。 (继承自 DataAnnotationsModelValidator) |
| Metadata |
在派生类中实现时,获取模型验证器的元数据。 (继承自 ModelValidator) |
| ModelBindingExecutionContext |
在派生类中实现时,获取执行上下文。 (继承自 ModelValidator) |
方法
| 名称 | 说明 |
|---|---|
| Equals(Object) |
确定指定的对象是否等于当前对象。 (继承自 Object) |
| GetHashCode() |
用作默认哈希函数。 (继承自 Object) |
| GetLocalizedErrorMessage(String) |
获取模型的本地化错误消息。 (继承自 DataAnnotationsModelValidator) |
| GetLocalizedString(String, Object[]) |
获取特定字符串的本地化版本。 (继承自 DataAnnotationsModelValidator) |
| GetType() |
获取当前实例的 Type。 (继承自 Object) |
| MemberwiseClone() |
创建当前 Object的浅表副本。 (继承自 Object) |
| ToString() |
返回一个表示当前对象的字符串。 (继承自 Object) |
| Validate(Object) |
返回模型的验证错误消息列表。 (继承自 DataAnnotationsModelValidator) |