Interface IGetsFailureMessage<TValidated, TParent>
An object which can get a human-readable message relating to the failure of a single validation rule.
Namespace: CSF.Validation.Messages
Assembly: CSF.Validation.Abstractions.dll
Syntax
public interface IGetsFailureMessage<in TValidated, in TParent>
Type Parameters
Name | Description |
---|---|
TValidated | The type of the validated value. |
TParent | The type of the parent validated value. |
Remarks
Such a message is intended to be suitable for display in a user interface, to an appropriate end-user. A good message tells the user what is invalid and indicates what steps should be taken to fix it.
This interface differs from the non-generic IGetsFailureMessage because its method GetFailureMessageAsync(TValidated, TParent, ValidationRuleResult, CancellationToken) receives two strongly typed parameters which contains the object under validation and also the parent value.
You are encouraged to read more about how validation message providers are used and selected at the documentation relating to message providers.
Methods
| Improve this Doc View SourceGetFailureMessageAsync(TValidated, TParent, ValidationRuleResult, CancellationToken)
Gets the validation failure message for the specified result.
Declaration
ValueTask<string> GetFailureMessageAsync(TValidated value, TParent parentValue, ValidationRuleResult result, CancellationToken token = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
TValidated | value | The value under validation. |
TParent | parentValue | The parent value under validation. |
ValidationRuleResult | result | A validation result, typically indicating failure. |
System.Threading.CancellationToken | token | An optional cancellation token. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask<System.String> | A human-readable message. |