Class IdCardValidator
- Namespace
- CloudyWing.FormValidators
- Assembly
- CloudyWing.FormValidators.dll
The identity card validator.
public sealed class IdCardValidator : FormValidatorBase, IFormValidator
- Inheritance
-
IdCardValidator
- Implements
- Inherited Members
Constructors
IdCardValidator(string, string, IdCardTypes, Func<string, string, IdCardTypes, string>)
Initializes a new instance of the IdCardValidator class.
public IdCardValidator(string column, string value, IdCardTypes idCardType = IdCardTypes.All, Func<string, string, IdCardTypes, string> customErrorMessageAccessor = null)
Parameters
columnstringThe column.
valuestringThe value.
idCardTypeIdCardTypesType of the identification card.
customErrorMessageAccessorFunc<string, string, IdCardTypes, string>The custom error message accessor. The arguments are column, value, identification card types.
Properties
CustomErrorMessage
Gets the custom error message.
protected override string CustomErrorMessage { get; }
Property Value
- string
The custom error message.
CustomErrorMessageAccessor
Gets or sets the custom error message accessor.
public Func<string, string, IdCardTypes, string> CustomErrorMessageAccessor { get; }
Property Value
- Func<string, string, IdCardTypes, string>
The custom error message accessor.
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.
IdCardType
Gets the type of the identification card.
public IdCardTypes IdCardType { get; }
Property Value
- IdCardTypes
The type of the identification card.
Methods
ValidateValue()
Validates the value.
protected override bool ValidateValue()
Returns
- bool
The validation result.