/// <summary> /// <para> /// Initializes a new instance of the <see cref="FormatValidatorAttribute" /> class with a regex pattern, /// matching options and a failure message template. /// </para> /// </summary> /// <param name="pattern">The pattern to match.</param> /// <param name="patternResourceName">The resource name containing the pattern for the regular expression.</param> /// <param name="patternResourceType">The type containing the resource for the regular expression.</param> /// <param name="options">The <see cref="RegexOptions" /> to use when matching.</param> internal FormatValidatorAttribute(string pattern, string patternResourceName, Type patternResourceType, RegexOptions options) { ValidatorArgumentsValidatorHelper.ValidateRegexIgnoresEmptyStringValidator(pattern, patternResourceName, patternResourceType); _pattern = pattern; _options = options; _patternResourceName = patternResourceName; _patternResourceType = patternResourceType; }
/// <summary> /// <para> /// Initializes a new instance of the <see cref="FormatValidator" /> class with a regex pattern, /// matching options and a failure message template. /// </para> /// </summary> /// <param name="pattern">The pattern to match.</param> /// <param name="options">The <see cref="RegexOptions" /> to use when matching.</param> /// <param name="messageTemplate">The message template.</param> /// <param name="negated">True if the validator must negate the result of the validation.</param> /// <param name="patternResourceName">The resource name containing the pattern for the regular expression.</param> /// <param name="patternResourceType">The type containing the resource for the regular expression.</param> public FormatValidator(string pattern, string patternResourceName, Type patternResourceType, RegexOptions options, string messageTemplate, bool negated) : base(messageTemplate, null, negated) { ValidatorArgumentsValidatorHelper.ValidateRegexIgnoresEmptyStringValidator(pattern, patternResourceName, patternResourceType); Pattern = pattern; _options = options; PatternResourceName = patternResourceName; PatternResourceType = patternResourceType; }
/// <summary> /// <para> /// Initializes a new instance of the <see cref="FormatValidatorAttribute" /> class with a regex pattern, /// matching options and a failure message template. /// </para> /// </summary> /// <param name="pattern">The pattern to match.</param> /// <param name="patternResourceName">The resource name containing the pattern for the regular expression.</param> /// <param name="patternResourceType">The type containing the resource for the regular expression.</param> /// <param name="options">The <see cref="RegexOptions"/> to use when matching.</param> /// /// <param name="propertyName">The name of the property which validator depends on.</param> /// <param name="inverse">True if the validator must inverse the propertyName value.</param> internal FormatValidatorAttribute(string pattern, string patternResourceName, Type patternResourceType, RegexOptions options, string propertyName = null, bool inverse = false) { ValidatorArgumentsValidatorHelper.ValidateRegexIgnoresEmptyStringValidator(pattern, patternResourceName, patternResourceType); _pattern = pattern; _options = options; _propertyName = propertyName; _inverse = inverse; _patternResourceName = patternResourceName; _patternResourceType = patternResourceType; }
/// <summary> /// <para> /// Initializes a new instance of the <see cref="FormatValidator" /> class with a regex pattern, /// matching options and a failure message template. /// </para> /// </summary> /// <param name="pattern">The pattern to match.</param> /// <param name="options">The <see cref="RegexOptions" /> to use when matching.</param> /// <param name="messageTemplate">The message template.</param> /// <param name="negated">True if the validator must negate the result of the validation.</param> /// <param name="propertyName">The name of the property which validator depends on.</param> /// <param name="inverse">True if the validator must inverse the propertyName value.</param> /// <param name="patternResourceName">The resource name containing the pattern for the regular expression.</param> /// <param name="patternResourceType">The type containing the resource for the regular expression.</param> public FormatValidator(string pattern, string patternResourceName, Type patternResourceType, RegexOptions options, string messageTemplate, bool negated, string propertyName = null, bool inverse = false) : base(messageTemplate, null, negated) { ValidatorArgumentsValidatorHelper.ValidateRegexIgnoresEmptyStringValidator(pattern, patternResourceName, patternResourceType); Pattern = pattern; _options = options; _dependPropertyName = propertyName; _inverse = inverse; PatternResourceName = patternResourceName; PatternResourceType = patternResourceType; }