Class MobilePhoneValidator
- Namespace
- CloudyWing.FormValidators
- Assembly
- CloudyWing.FormValidators.dll
The mobile phone validator.
public sealed class MobilePhoneValidator : FormValidatorBase, IFormValidator
- Inheritance
-
MobilePhoneValidator
- Implements
- Inherited Members
Constructors
MobilePhoneValidator(string, string, MobilePhoneFormats, Func<string, string, MobilePhoneFormats, string>)
Initializes a new instance of the MobilePhoneValidator class.
public MobilePhoneValidator(string column, string value, MobilePhoneFormats formats, Func<string, string, MobilePhoneFormats, string> customErrorMessageAccessor = null)
Parameters
columnstringThe column.
valuestringThe value.
formatsMobilePhoneFormatsThe formats.
customErrorMessageAccessorFunc<string, string, MobilePhoneFormats, string>The custom error message accessor. The arguments are column, value, mobile phone formats.
MobilePhoneValidator(string, string, Func<string, string, MobilePhoneFormats, string>)
Initializes a new instance of the MobilePhoneValidator class.
public MobilePhoneValidator(string column, string value, Func<string, string, MobilePhoneFormats, string> customErrorMessageAccessor = null)
Parameters
columnstringThe column.
valuestringThe value.
customErrorMessageAccessorFunc<string, string, MobilePhoneFormats, string>The custom error message accessor. The arguments are column, value, mobile phone formats.
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, MobilePhoneFormats, string> CustomErrorMessageAccessor { get; set; }
Property Value
- Func<string, string, MobilePhoneFormats, string>
The custom error message accessor.
DefaultErrorMessage
Gets the default error message.
protected override string DefaultErrorMessage { get; }
Property Value
- string
The default error message.
Formats
Gets or sets the formats.
public MobilePhoneFormats Formats { get; }
Property Value
- MobilePhoneFormats
The formats.
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.
Pattern
Gets the regex pattern.
public string Pattern { get; }
Property Value
- string
The regex pattern.
Methods
ValidateValue()
Validates the value.
protected override bool ValidateValue()
Returns
- bool
The validation result.