Table of Contents

Class ConfigurablePropertyValidator<T, TProperty, TOptions>

Namespace
ExpressValidator
Assembly
ExpressValidator.dll
public class ConfigurablePropertyValidator<T, TProperty, TOptions> : PropertyValidator<T, TProperty>, IPropertyValidator<T, TProperty>, IPropertyValidator

Type Parameters

T
TProperty
TOptions
Inheritance
PropertyValidator<T, TProperty>
ConfigurablePropertyValidator<T, TProperty, TOptions>
Implements
IPropertyValidator<T, TProperty>
IPropertyValidator
Inherited Members
PropertyValidator<T, TProperty>.IsValid(ValidationContext<T>, TProperty)
PropertyValidator<T, TProperty>.Name

Properties

Name

The name of the validator. This is usually the type name without any generic parameters. This is used as the default Error Code for the validator.

public override string Name { get; }

Property Value

string

Methods

GetDefaultMessageTemplate(string)

Returns the default error message template for this validator, when not overridden.

protected override string GetDefaultMessageTemplate(string errorCode)

Parameters

errorCode string

The currently configured error code for the validator.

Returns

string

IsValid(ValidationContext<T>, TProperty)

Validates a specific property value.

public override bool IsValid(ValidationContext<T> context, TProperty value)

Parameters

context ValidationContext<T>

The validation context. The parent object can be obtained from here.

value TProperty

The current property value to validate

Returns

bool

True if valid, otherwise false.