ControllerBase.TryValidateModel 方法

定义

重载

TryValidateModel(Object)

验证指定的 model 实例。

TryValidateModel(Object, String)

验证指定的 model 实例。

TryValidateModel(Object)

Source:
ControllerBase.cs
Source:
ControllerBase.cs
Source:
ControllerBase.cs

验证指定的 model 实例。

public:
 virtual bool TryValidateModel(System::Object ^ model);
[Microsoft.AspNetCore.Mvc.NonAction]
public virtual bool TryValidateModel (object model);
[<Microsoft.AspNetCore.Mvc.NonAction>]
abstract member TryValidateModel : obj -> bool
override this.TryValidateModel : obj -> bool
Public Overridable Function TryValidateModel (model As Object) As Boolean

参数

model
Object

要验证的模型。

返回

true 如果 有效, ModelState 则为 ; false 否则为 。

属性

适用于

TryValidateModel(Object, String)

Source:
ControllerBase.cs
Source:
ControllerBase.cs
Source:
ControllerBase.cs

验证指定的 model 实例。

public:
 virtual bool TryValidateModel(System::Object ^ model, System::String ^ prefix);
[Microsoft.AspNetCore.Mvc.NonAction]
public virtual bool TryValidateModel (object model, string prefix);
[Microsoft.AspNetCore.Mvc.NonAction]
public virtual bool TryValidateModel (object model, string? prefix);
[<Microsoft.AspNetCore.Mvc.NonAction>]
abstract member TryValidateModel : obj * string -> bool
override this.TryValidateModel : obj * string -> bool
Public Overridable Function TryValidateModel (model As Object, prefix As String) As Boolean

参数

model
Object

要验证的模型。

prefix
String

在 中 ModelState查找信息时要使用的键。

返回

true 如果 有效, ModelState 则为 ;false 否则为 。

属性

适用于