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
ShallowValidate(ModelMetadata, BodyModelValidatorContext, object, IEnumerable<ModelValidator>)
protected virtual bool ShallowValidate(ModelMetadata metadata, BodyModelValidatorContext validationContext, object container, IEnumerable<ModelValidator> validators)
Parameters
metadata
ModelMetadatavalidationContext
BodyModelValidatorContextcontainer
objectvalidators
IEnumerable<ModelValidator>
Returns
ShouldValidateType(Type)
Determines whether instances of a particular type should be validated.
public virtual bool ShouldValidateType(Type type)
Parameters
type
TypeThe 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
model
objectThe model to be validated.
type
TypeThe Type to use for validation.
metadataProvider
ModelMetadataProviderThe ModelMetadataProvider used to provide model metadata.
actionContext
HttpActionContextThe HttpActionContext within which the model is being validated.
keyPrefix
stringThe string to append to the key for any validation errors.
Returns
- bool
true if model is valid, false otherwise.
ValidateElements(IEnumerable, BodyModelValidatorContext)
protected virtual bool ValidateElements(IEnumerable model, BodyModelValidatorContext validationContext)
Parameters
model
IEnumerablevalidationContext
BodyModelValidatorContext
Returns
ValidateNodeAndChildren(ModelMetadata, BodyModelValidatorContext, object, IEnumerable<ModelValidator>)
protected virtual bool ValidateNodeAndChildren(ModelMetadata metadata, BodyModelValidatorContext validationContext, object container, IEnumerable<ModelValidator> validators)
Parameters
metadata
ModelMetadatavalidationContext
BodyModelValidatorContextcontainer
objectvalidators
IEnumerable<ModelValidator>
Returns
ValidateProperties(ModelMetadata, BodyModelValidatorContext)
protected virtual bool ValidateProperties(ModelMetadata metadata, BodyModelValidatorContext validationContext)
Parameters
metadata
ModelMetadatavalidationContext
BodyModelValidatorContext