Interface IGetsFailureMessage<TValidated>
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>
Type Parameters
Name | Description |
---|---|
TValidated | The type of the 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, ValidationRuleResult, CancellationToken) receives a strongly typed parameter which contains the object under validation.
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, ValidationRuleResult, CancellationToken)
Gets the validation failure message for the specified result.
Declaration
ValueTask<string> GetFailureMessageAsync(TValidated value, ValidationRuleResult result, CancellationToken token = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
TValidated | value | The 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. |