Udostępnij za pośrednictwem


ModelValidator.GetModelValidator Method

Returns a composite model validator for the model.

Namespace:  System.Web.Mvc
Assembly:  System.Web.Mvc (in System.Web.Mvc.dll)

Syntax

'Declaration
Public Shared Function GetModelValidator ( _
    metadata As ModelMetadata, _
    context As ControllerContext _
) As ModelValidator
public static ModelValidator GetModelValidator(
    ModelMetadata metadata,
    ControllerContext context
)
public:
static ModelValidator^ GetModelValidator(
    ModelMetadata^ metadata, 
    ControllerContext^ context
)

Parameters

Return Value

Type: System.Web.Mvc.ModelValidator
A composite model validator for the model.

Remarks

The TryValidateModel method calls this method and runs all the validators for the model's properties. If no validators fail, the TryValidateModel method runs all the validators of the object itself (at the type level).

See Also

Reference

ModelValidator Class

System.Web.Mvc Namespace