PriceValidationAttributeBase

Ecng.ComponentModel

Base validation attribute for Price that validates only the Value component.

继承自: ValidationAttribute

实现: IValidator

属性

AcceptNull
protected virtual bool AcceptNull { get; }
value = priceValidationAttributeBase.AcceptNull

Gets a value indicating whether null price values are always accepted (independently of DisableNullCheck).

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

If true, null values are treated as valid (only for attributes where null is not unconditionally allowed).

方法

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

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

value
The value to validate.

返回值: True if the value is valid; otherwise, false.

Validate
protected abstract bool Validate(decimal value)
result = priceValidationAttributeBase.Validate(value)

Core validation over the numeric price value (already extracted).

value
Price numeric value.