Note

Access to this page requires authorization. You can try signing in or .

Access to this page requires authorization. You can try .

ValidationVisitor Class

Definition

Namespace:
Microsoft.AspNetCore.Mvc.ModelBinding.Validation
Assembly:
Microsoft.AspNetCore.Mvc.Core.dll
Package:
Microsoft.AspNetCore.Mvc.Core v1.0.0
Package:
Microsoft.AspNetCore.Mvc.Core v1.1.0
Package:
Microsoft.AspNetCore.App.Ref v10.0.0
Package:
Microsoft.AspNetCore.App.Ref v11.0.0-preview.4.26230.115
Package:
Microsoft.AspNetCore.Mvc.Core v2.0.0
Package:
Microsoft.AspNetCore.Mvc.Core v2.1.0
Package:
Microsoft.AspNetCore.Mvc.Core v2.2.0
Package:
Microsoft.AspNetCore.App.Ref v3.0.1
Package:
Microsoft.AspNetCore.App.Ref v3.1.10
Package:
Microsoft.AspNetCore.App.Ref v5.0.0
Package:
Microsoft.AspNetCore.App.Ref v6.0.36
Package:
Microsoft.AspNetCore.App.Ref v7.0.5
Package:
Microsoft.AspNetCore.App.Ref v8.0.19
Package:
Microsoft.AspNetCore.App.Ref v9.0.8
Source:
ValidationVisitor.cs
Source:
ValidationVisitor.cs
Source:
ValidationVisitor.cs

Important

Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.

A visitor implementation that interprets ValidationStateDictionary to traverse a model object graph and perform validation.

public ref class ValidationVisitor
public class ValidationVisitor
type ValidationVisitor = class
Public Class ValidationVisitor
Inheritance
ValidationVisitor

Constructors

Name Description
ValidationVisitor(ActionContext, IModelValidatorProvider, ValidatorCache, IModelMetadataProvider, ValidationStateDictionary)

Creates a new ValidationVisitor.

ValidationVisitor(ActionContext, IModelValidatorProvider, ValidatorCache, IModelMetadataProvider, ValidationStateDictionary)

Creates a new ValidationVisitor.

Properties

Name Description
AllowShortCircuitingValidationWhenNoValidatorsArePresent
Obsolete.

Gets or sets a value that determines if ValidationVisitor can short circuit validation when a model does not have any associated validators.

Cache

The validator cache.

Container

The container.

Context

The action context.

CurrentPath
Key

The key.

MaxValidationDepth

Gets or sets the maximum depth to constrain the validation visitor when validating.

ValidationVisitor traverses the object graph of the model being validated. For models that are very deep or are infinitely recursive, validation may result in stack overflow.

When not null, Visit(ModelMetadata, String, Object) will throw if current traversal depth exceeds the specified value.

Metadata

The model metadata.

MetadataProvider

The model metadata provider.

Model

The model.

ModelState

The model state.

Strategy

The validation strategy.

ValidateComplexTypesIfChildValidationFails

Indicates whether validation of a complex type should be performed if validation fails for any of its children. The default behavior is false.

ValidationState

The validation state.

ValidatorProvider

The model validator provider.

Methods

Name Description
GetValidationEntry(Object)

Get the validation entry for the model.

SuppressValidation(String)

Supress validation for a given key.

Validate(ModelMetadata, String, Object, Boolean, Object)

Validates a object.

Validate(ModelMetadata, String, Object, Boolean)

Validates a object.

Validate(ModelMetadata, String, Object)

Validates a object.

ValidateNode()

Validates a single node in a model object graph.

Visit(ModelMetadata, String, Object)

Validate something in a model.

VisitChildren(IValidationStrategy)

Validate all the child nodes using the specified strategy.

VisitComplexType(IValidationStrategy)

Validate complex types, this covers everything VisitSimpleType does not i.e. both enumerations and complex types.

VisitSimpleType()

Validate a simple type.

Applies to


Feedback

Was this page helpful?