Class DefaultBodyModelValidator
- Namespace
- System.Web.Http.Validation
- Assembly
- System.Web.Http.dll
Represents a class used to recursively validate an object.
public class DefaultBodyModelValidator : IBodyModelValidator
- Inheritance
-
DefaultBodyModelValidator
- Implements
- Inherited Members
Constructors
DefaultBodyModelValidator()
Initializes a new instance of the DefaultBodyModelValidator class.
public DefaultBodyModelValidator()
Methods
ShouldValidateType(Type)
Determines whether instances of a particular type should be validated.
public virtual bool ShouldValidateType(Type type)
Parameters
typeTypeThe type to validate.
Returns
- bool
true if the type should be validated; false otherwise.
Validate(object, Type, ModelMetadataProvider, HttpActionContext, string)
Determines whether the model is valid and adds any validation errors to the actionContext's ModelStateDictionary.
public bool Validate(object model, Type type, ModelMetadataProvider metadataProvider, HttpActionContext actionContext, string keyPrefix)
Parameters
modelobjectThe model to be validated.
typeTypeThe Type to use for validation.
metadataProviderModelMetadataProviderThe ModelMetadataProvider used to provide model metadata.
actionContextHttpActionContextThe HttpActionContext within which the model is being validated.
keyPrefixstringThe string to append to the key for any validation errors.
Returns
- bool
true if model is valid, false otherwise.