This topic has not yet been rated - Rate this topic

ModelValidator.GetModelValidator Method

.NET Framework 4

Returns a composite model validator for the model.

Namespace:  System.Web.Mvc
Assembly:  System.Web.Mvc (in System.Web.Mvc.dll)
public static ModelValidator GetModelValidator(
	ModelMetadata metadata,
	ControllerContext context
)

Parameters

metadata
Type: System.Web.Mvc.ModelMetadata
The metadata.
context
Type: System.Web.Mvc.ControllerContext
The controller context.

Return Value

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

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).

Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ