Table of Contents

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

errorMessageAccessor Func<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

name string

The 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

value object

The value to check.

Returns

bool

True if the value is a non-null, non-empty string; otherwise, false.