MvcOptions.MaxValidationDepth Property


Gets or sets the maximum depth to constrain the validation visitor when validating. Set to null to disable this feature.

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, ValidationVisitor will throw if traversing an object exceeds the maximum allowed validation depth.

 property Nullable<int> MaxValidationDepth { Nullable<int> get(); void set(Nullable<int> value); };
public int? MaxValidationDepth { get; set; }
member this.MaxValidationDepth : Nullable<int> with get, set
Public Property MaxValidationDepth As Nullable(Of Integer)

Property Value


The default value is 32.

Applies to