Interface IHasFailureMessageUsageCriteria
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
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(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(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(ValidationRuleResult result)
Parameters
Type | Name | Description |
---|---|---|
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. |