Class LessThanValidator<T>
- Namespace
- CloudyWing.FormValidators.Core
- Assembly
- CloudyWing.FormValidators.dll
The less than other column value validator abstract class.
public abstract class LessThanValidator<T> : FormValidatorBase, IFormValidator where T : struct, IConvertible, IComparable<T>, IEquatable<T>
Type Parameters
TThe value type.
- Inheritance
-
LessThanValidator<T>
- Implements
- Derived
- Inherited Members
Constructors
LessThanValidator(string, string, string, string, bool, Func<string, string, string, string, bool, string>)
Initializes a new instance of the LessThanValidator<T> class.
protected LessThanValidator(string column, string value, string comparisonColumn, string comparisonValue, bool allowedEqual = true, Func<string, string, string, string, bool, string> customErrorMessageAccessor = null)
Parameters
columnstringThe column.
valuestringThe value.
comparisonColumnstringThe comparison column.
comparisonValuestringThe comparison value.
allowedEqualboolif set to
true[allowed equal].customErrorMessageAccessorFunc<string, string, string, string, bool, string>The custom error message accessor. The arguments are column, value, comparison column, comparison value, allowed equal.
Properties
AllowedEqual
Gets or sets a value indicating whether [allowed equal].
public bool AllowedEqual { get; }
Property Value
- bool
trueif [allowed equal]; otherwise,false.
ComparisonColumn
Gets or sets the comparison column.
public string ComparisonColumn { get; }
Property Value
- string
The comparison column.
ComparisonValue
Gets or sets the comparison value.
public string ComparisonValue { get; }
Property Value
- string
The comparison value.
CustomErrorMessage
Gets the custom error message.
protected override string CustomErrorMessage { get; }
Property Value
- string
The custom error message.
CustomErrorMessageAccessor
Gets the custom range message format.
public Func<string, string, string, string, bool, string> CustomErrorMessageAccessor { get; set; }
Property Value
DefaultErrorMessage
Gets the default error message.
protected override string DefaultErrorMessage { get; }
Property Value
- string
The default error message.
HasCustomErrorMessage
Gets a value indicating whether this instance has custom error message.
protected override bool HasCustomErrorMessage { get; }
Property Value
- bool
trueif this instance has custom error message; otherwise,false.
Methods
TryParse(string, out T)
Tries the parse.
protected abstract bool TryParse(string value, out T result)
Parameters
valuestringThe value.
resultTThe result.
Returns
- bool
Parse value to type
Tresult.
ValidateValue()
Validates the value.
protected override bool ValidateValue()
Returns
- bool
The validation result.