ComparableValidationAttribute

Ecng.ComponentModel

Provides a base class for validation attributes that compare values of a struct type.

Erbt von: ValidationAttribute

Implementiert: IValidator

Eigenschaften

DisableNullCheck
public bool DisableNullCheck { get; set; }
value = comparableValidationAttribute.DisableNullCheck
comparableValidationAttribute.DisableNullCheck = value

Gets or sets a value indicating whether to disable the null check. When set to true, null values bypass validation.

Methoden

IsValid
public override bool IsValid(object value)
result = comparableValidationAttribute.IsValid(value)

Validates the specified value by converting it and applying the custom validation.

value
The value to validate.

Rückgabe: True if the value is valid; otherwise, false.

Validate
protected abstract bool Validate(T? value, bool disableNullCheck)
result = comparableValidationAttribute.Validate(value, disableNullCheck)

Validates the given nullable value using a custom rule.

value
The nullable value to validate.
disableNullCheck
A flag indicating whether null check should be disabled.

Rückgabe: True if the value passes the validation rule; otherwise, false.