MvcOptions.AllowShortCircuitingValidationWhenNoValidatorsArePresent Property

Definition

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

public:
 property bool AllowShortCircuitingValidationWhenNoValidatorsArePresent { bool get(); void set(bool value); };
public bool AllowShortCircuitingValidationWhenNoValidatorsArePresent { get; set; }
member this.AllowShortCircuitingValidationWhenNoValidatorsArePresent : bool with get, set
Public Property AllowShortCircuitingValidationWhenNoValidatorsArePresent As Boolean

Property Value

The default value is true if the version is Version_2_2 or later; false otherwise.

Remarks

When HasValidators is true, that is, it is determined that a model or any of it's properties or collection elements cannot have any validators, ValidationVisitor can short-circuit validation for the model and mark the object graph as valid. Setting this property to true, allows ValidationVisitor to perform this optimization.

This property is associated with a compatibility switch and can provide a different behavior depending on the configured compatibility version for the application. See CompatibilityVersion for guidance and examples of setting the application's compatibility version.

Configuring the desired value of the compatibility switch by calling this property's setter will take precedence over the value implied by the application's CompatibilityVersion.

If the application's compatibility version is set to Version_2_2 then this setting will have the value true unless explicitly configured.

If the application's compatibility version is set to Version_2_1 or earlier then this setting will have the value false unless explicitly configured.

Applies to