Class FormattedValidator<T, TResource>
- Namespace
- LfrlAnvil.Validation.Validators
- Assembly
- LfrlAnvil.Validation.dll
Represents a generic object validator with formatted messages.
public sealed class FormattedValidator<T, TResource> : IValidator<T, FormattedValidatorResult<TResource>>
Type Parameters
T
Object type.
TResource
Message's resource type.
- Inheritance
-
FormattedValidator<T, TResource>
- Implements
-
IValidator<T, FormattedValidatorResult<TResource>>
- Inherited Members
- Extension Methods
Constructors
FormattedValidator(IValidator<T, ValidationMessage<TResource>>, IValidationMessageFormatter<TResource>, Func<IFormatProvider?>?)
Creates a new FormattedValidator<T, TResource> instance.
public FormattedValidator(IValidator<T, ValidationMessage<TResource>> validator, IValidationMessageFormatter<TResource> formatter, Func<IFormatProvider?>? formatProvider = null)
Parameters
validator
IValidator<T, ValidationMessage<TResource>>Underlying validator.
formatter
IValidationMessageFormatter<TResource>Underlying validation message formatter.
formatProvider
Func<IFormatProvider>Optional format provider factory.
Properties
FormatProvider
Optional format provider factory.
public Func<IFormatProvider?>? FormatProvider { get; }
Property Value
Formatter
Underlying validation message formatter.
public IValidationMessageFormatter<TResource> Formatter { get; }
Property Value
- IValidationMessageFormatter<TResource>
Validator
Underlying validator.
public IValidator<T, ValidationMessage<TResource>> Validator { get; }
Property Value
- IValidator<T, ValidationMessage<TResource>>
Methods
Validate(T)
Validates the provided obj
.
[Pure]
public Chain<FormattedValidatorResult<TResource>> Validate(T obj)
Parameters
obj
TObject to validate.
Returns
- Chain<FormattedValidatorResult<TResource>>
Result of
obj
validation.