C# Class FluentValidation.WebApi.FluentValidationBodyModelValidator

Recursively validate an object. Is just a copy of the DefaultBodyModelValidator but includes a "patch" for the FluentValidationModelValidator When the whole model is validated the errors get added to the ModelState grouped by property instead of all under the model. It also changes the check of previous errors to avoid missing error messages when there are bind errors If the FluentValidationModelValidator is not used to validate, fallbacks to the DefaultBodyModelValidator behaviour Another difference is that the IModelValidatorCache had to be removed because it's internal to the asp net framework (affects performance but not the behaviour)
Inheritance: IBodyModelValidator
Datei anzeigen Open project: JeremySkinner/FluentValidation

Public Methods

Method Description
Validate ( object model, Type type, System.Web.Http.Metadata.ModelMetadataProvider metadataProvider, System.Web.Http.Controllers.HttpActionContext actionContext, string keyPrefix ) : bool

Private Methods

Method Description
CreateIndexModelName ( string parentName, int index ) : string
CreateIndexModelName ( string parentName, string index ) : string
CreatePropertyModelName ( string prefix, string propertyName ) : string
GetElementType ( Type type ) : Type
IsSimpleType ( Type type ) : bool
ShallowValidate ( System.Web.Http.Metadata.ModelMetadata metadata, ValidationContext validationContext, object container ) : bool
ValidateElements ( IEnumerable model, ValidationContext validationContext ) : bool
ValidateNodeAndChildren ( System.Web.Http.Metadata.ModelMetadata metadata, ValidationContext validationContext, object container ) : bool
ValidateProperties ( System.Web.Http.Metadata.ModelMetadata metadata, ValidationContext validationContext ) : bool

Method Details

Validate() public method

public Validate ( object model, Type type, System.Web.Http.Metadata.ModelMetadataProvider metadataProvider, System.Web.Http.Controllers.HttpActionContext actionContext, string keyPrefix ) : bool
model object
type System.Type
metadataProvider System.Web.Http.Metadata.ModelMetadataProvider
actionContext System.Web.Http.Controllers.HttpActionContext
keyPrefix string
return bool