ObjectModelValidator.Validate 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
Validate(ActionContext, ValidationStateDictionary, String, Object) |
验证提供的对象。 |
Validate(ActionContext, ValidationStateDictionary, String, Object, ModelMetadata) |
验证提供的对象模型。
如果 |
Validate(ActionContext, ValidationStateDictionary, String, Object, ModelMetadata, Object) |
验证提供的对象模型。
如果 |
Validate(ActionContext, ValidationStateDictionary, String, Object)
- Source:
- ObjectModelValidator.cs
- Source:
- ObjectModelValidator.cs
- Source:
- ObjectModelValidator.cs
验证提供的对象。
public:
virtual void Validate(Microsoft::AspNetCore::Mvc::ActionContext ^ actionContext, Microsoft::AspNetCore::Mvc::ModelBinding::Validation::ValidationStateDictionary ^ validationState, System::String ^ prefix, System::Object ^ model);
public virtual void Validate (Microsoft.AspNetCore.Mvc.ActionContext actionContext, Microsoft.AspNetCore.Mvc.ModelBinding.Validation.ValidationStateDictionary validationState, string prefix, object model);
public virtual void Validate (Microsoft.AspNetCore.Mvc.ActionContext actionContext, Microsoft.AspNetCore.Mvc.ModelBinding.Validation.ValidationStateDictionary? validationState, string? prefix, object? model);
abstract member Validate : Microsoft.AspNetCore.Mvc.ActionContext * Microsoft.AspNetCore.Mvc.ModelBinding.Validation.ValidationStateDictionary * string * obj -> unit
override this.Validate : Microsoft.AspNetCore.Mvc.ActionContext * Microsoft.AspNetCore.Mvc.ModelBinding.Validation.ValidationStateDictionary * string * obj -> unit
Public Overridable Sub Validate (actionContext As ActionContext, validationState As ValidationStateDictionary, prefix As String, model As Object)
参数
- actionContext
- ActionContext
与 ActionContext 当前请求关联的 。
- validationState
- ValidationStateDictionary
ValidationStateDictionary。 可能为 null。
- prefix
- String
模型前缀。 用于将模型对象映射到 中的 validationState
条目。
- model
- Object
对象模型。
实现
适用于
Validate(ActionContext, ValidationStateDictionary, String, Object, ModelMetadata)
- Source:
- ObjectModelValidator.cs
- Source:
- ObjectModelValidator.cs
- Source:
- ObjectModelValidator.cs
验证提供的对象模型。
如果 model
为 null
,而 metadata
的 IsRequired 为 true
,将添加一个或多个不会的 Validate(ActionContext, ValidationStateDictionary, String, Object) 模型状态错误。
public:
virtual void Validate(Microsoft::AspNetCore::Mvc::ActionContext ^ actionContext, Microsoft::AspNetCore::Mvc::ModelBinding::Validation::ValidationStateDictionary ^ validationState, System::String ^ prefix, System::Object ^ model, Microsoft::AspNetCore::Mvc::ModelBinding::ModelMetadata ^ metadata);
public virtual void Validate (Microsoft.AspNetCore.Mvc.ActionContext actionContext, Microsoft.AspNetCore.Mvc.ModelBinding.Validation.ValidationStateDictionary validationState, string prefix, object model, Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata metadata);
public virtual void Validate (Microsoft.AspNetCore.Mvc.ActionContext actionContext, Microsoft.AspNetCore.Mvc.ModelBinding.Validation.ValidationStateDictionary? validationState, string? prefix, object? model, Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata metadata);
abstract member Validate : Microsoft.AspNetCore.Mvc.ActionContext * Microsoft.AspNetCore.Mvc.ModelBinding.Validation.ValidationStateDictionary * string * obj * Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata -> unit
override this.Validate : Microsoft.AspNetCore.Mvc.ActionContext * Microsoft.AspNetCore.Mvc.ModelBinding.Validation.ValidationStateDictionary * string * obj * Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata -> unit
Public Overridable Sub Validate (actionContext As ActionContext, validationState As ValidationStateDictionary, prefix As String, model As Object, metadata As ModelMetadata)
参数
- actionContext
- ActionContext
- validationState
- ValidationStateDictionary
- prefix
- String
模型前缀键。
- model
- Object
对象模型。
- metadata
- ModelMetadata
适用于
Validate(ActionContext, ValidationStateDictionary, String, Object, ModelMetadata, Object)
- Source:
- ObjectModelValidator.cs
验证提供的对象模型。
如果 model
为 null
,而 metadata
的 IsRequired 为 true
,将添加一个或多个不会的 Validate(ActionContext, ValidationStateDictionary, String, Object) 模型状态错误。
public:
virtual void Validate(Microsoft::AspNetCore::Mvc::ActionContext ^ actionContext, Microsoft::AspNetCore::Mvc::ModelBinding::Validation::ValidationStateDictionary ^ validationState, System::String ^ prefix, System::Object ^ model, Microsoft::AspNetCore::Mvc::ModelBinding::ModelMetadata ^ metadata, System::Object ^ container);
public virtual void Validate (Microsoft.AspNetCore.Mvc.ActionContext actionContext, Microsoft.AspNetCore.Mvc.ModelBinding.Validation.ValidationStateDictionary validationState, string prefix, object model, Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata metadata, object container);
public virtual void Validate (Microsoft.AspNetCore.Mvc.ActionContext actionContext, Microsoft.AspNetCore.Mvc.ModelBinding.Validation.ValidationStateDictionary? validationState, string? prefix, object? model, Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata metadata, object? container);
abstract member Validate : Microsoft.AspNetCore.Mvc.ActionContext * Microsoft.AspNetCore.Mvc.ModelBinding.Validation.ValidationStateDictionary * string * obj * Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata * obj -> unit
override this.Validate : Microsoft.AspNetCore.Mvc.ActionContext * Microsoft.AspNetCore.Mvc.ModelBinding.Validation.ValidationStateDictionary * string * obj * Microsoft.AspNetCore.Mvc.ModelBinding.ModelMetadata * obj -> unit
Public Overridable Sub Validate (actionContext As ActionContext, validationState As ValidationStateDictionary, prefix As String, model As Object, metadata As ModelMetadata, container As Object)
参数
- actionContext
- ActionContext
- validationState
- ValidationStateDictionary
- prefix
- String
模型前缀键。
- model
- Object
对象模型。
- metadata
- ModelMetadata
- container
- Object
模型容器