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)
驗證提供的 物件。
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)
驗證提供的物件模型。
如果 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)
驗證提供的物件模型。
如果 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
模型容器