Skip to content
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.

Commit

Permalink
Move property definitions below constructor in ValidationVisitor
Browse files Browse the repository at this point in the history
Remove incorrect virtual modifier on one of the Validate overloads
  • Loading branch information
JeremySkinner authored and rynowak committed Nov 22, 2017
1 parent 711a618 commit 008a562
Showing 1 changed file with 19 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,6 @@ namespace Microsoft.AspNetCore.Mvc.ModelBinding.Validation
/// </summary>
public class ValidationVisitor
{
protected IModelValidatorProvider ValidatorProvider { get; }
protected IModelMetadataProvider MetadataProvider { get; }
protected ValidatorCache Cache { get; }
protected ActionContext Context { get; }
protected ModelStateDictionary ModelState { get; }
protected ValidationStateDictionary ValidationState { get; }
protected ValidationStack CurrentPath { get; }

protected object Container { get; set; }
protected string Key { get; set; }
protected object Model { get; set; }
protected ModelMetadata Metadata { get; set; }
protected IValidationStrategy Strategy { get; set; }

/// <summary>
/// Indicates whether validation of a complex type should be performed if validation fails for any of its children. The default behavior is false.
/// </summary>
public bool ValidateComplexTypesIfChildValidationFails { get; set; }

/// <summary>
/// Creates a new <see cref="ValidationVisitor"/>.
/// </summary>
Expand Down Expand Up @@ -74,15 +55,33 @@ public ValidationVisitor(
ModelState = actionContext.ModelState;
CurrentPath = new ValidationStack();
}

protected IModelValidatorProvider ValidatorProvider { get; }
protected IModelMetadataProvider MetadataProvider { get; }
protected ValidatorCache Cache { get; }
protected ActionContext Context { get; }
protected ModelStateDictionary ModelState { get; }
protected ValidationStateDictionary ValidationState { get; }
protected ValidationStack CurrentPath { get; }

protected object Container { get; set; }
protected string Key { get; set; }
protected object Model { get; set; }
protected ModelMetadata Metadata { get; set; }
protected IValidationStrategy Strategy { get; set; }

/// <summary>
/// Indicates whether validation of a complex type should be performed if validation fails for any of its children. The default behavior is false.
/// </summary>
public bool ValidateComplexTypesIfChildValidationFails { get; set; }
/// <summary>
/// Validates a object.
/// </summary>
/// <param name="metadata">The <see cref="ModelMetadata"/> associated with the model.</param>
/// <param name="key">The model prefix key.</param>
/// <param name="model">The model object.</param>
/// <returns><c>true</c> if the object is valid, otherwise <c>false</c>.</returns>
public virtual bool Validate(ModelMetadata metadata, string key, object model)
public bool Validate(ModelMetadata metadata, string key, object model)
{
return Validate(metadata, key, model, alwaysValidateAtTopLevel: false);
}
Expand Down

0 comments on commit 008a562

Please sign in to comment.