Interface IHasFailureMessageUsageCriteria<TValidated>
An object which can use custom logic to determine whether it may be used to provide a failure message.
Namespace: CSF.Validation.Messages
Assembly: CSF.Validation.Abstractions.dll
Syntax
public interface IHasFailureMessageUsageCriteria<in TValidated>
Type Parameters
Name | Description |
---|---|
TValidated | The type of the validated value. |
Remarks
This interface is only useful when combined with one of the failure-message-provision interfaces:
Generally, using FailureMessageStrategyAttribute is a superior and more performant mechanism for selecting an appropriate message-provider class. However, for situations where that attribute alone is insufficent and custom/arbitrary logic must be used to determine whether a class may provide a message or not, this interface may be implemented and the CanGetFailureMessage(TValidated, ValidationRuleResult) method used to provide that logic.
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 SourceCanGetFailureMessage(TValidated, ValidationRuleResult)
Gets a value which indicates whether or not the current class may be used to provide a failure message for the specified validation rule result.
Declaration
bool CanGetFailureMessage(TValidated value, ValidationRuleResult result)
Parameters
Type | Name | Description |
---|---|---|
TValidated | value | The value under validation. |
ValidationRuleResult | result | A validation rule result. |
Returns
Type | Description |
---|---|
System.Boolean | true if the current instance may provide a message for the result; false otherwise. |