Class StringValueBaseAttribute
- Namespace
- NuvTools.Validation.Annotations
- Assembly
- NuvTools.Validation.dll
Base class for validation attributes that validate string values. Provides common functionality for string-based validation scenarios.
public class StringValueBaseAttribute : ValidationAttribute
- Inheritance
-
StringValueBaseAttribute
- Derived
- Inherited Members
- Extension Methods
Constructors
StringValueBaseAttribute(Func<string>)
Base class for validation attributes that validate string values. Provides common functionality for string-based validation scenarios.
public StringValueBaseAttribute(Func<string> errorMessageAccessor)
Parameters
errorMessageAccessorFunc<string>A function that returns the error message to use when validation fails.
Methods
FormatErrorMessage(string)
Applies formatting to a specified error message. (Overrides FormatErrorMessage(string))
public override string FormatErrorMessage(string name)
Parameters
namestringThe name to include in the formatted string.
Returns
- string
A localized string to describe the validation requirement.
IsValidValue(object?)
Determines whether the provided value is a valid non-empty string.
protected static bool IsValidValue(object? value)
Parameters
valueobjectThe value to check.
Returns
- bool
True if the value is a non-null, non-empty string; otherwise, false.