PriceRangeAttribute
Ecng.ComponentModel
Validates that a Price value is within the specified range (inclusive).
继承自: RangeAttribute
实现: IValidator
构造函数
PriceRangeAttribute
public PriceRangeAttribute(decimal minimum, decimal maximum)
priceRangeAttribute = PriceRangeAttribute(minimum, maximum)
Creates a new instance of PriceRangeAttribute.
- minimum
- Minimum value (inclusive).
- maximum
- Maximum value (inclusive).
属性
DisableNullCheck
public bool DisableNullCheck { get; set; }
value = priceRangeAttribute.DisableNullCheck
priceRangeAttribute.DisableNullCheck = value
Gets or sets a value indicating whether null checks should be disabled.
MaximumDec
public decimal MaximumDec { get; }
value = priceRangeAttribute.MaximumDec
Maximum value (inclusive).
MinimumDec
public decimal MinimumDec { get; }
value = priceRangeAttribute.MinimumDec
Minimum value (inclusive).
方法
IsValid
public override bool IsValid(object value)
result = priceRangeAttribute.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.