Class RuleWithMessageCandidateTypeDecorator
A decorator for IGetsCandidateMessageTypes which adds an additional message provider for rules which implement a rule-with-message interface.
Inheritance
Implements
Inherited Members
Namespace: CSF.Validation.Messages
Assembly: CSF.Validation.dll
Syntax
public class RuleWithMessageCandidateTypeDecorator : IGetsCandidateMessageTypes
Remarks
This deals with rules which implement either IRuleWithMessage<TValidated> or IRuleWithMessage<TValidated, TParent>.
Constructors
| Improve this Doc View SourceRuleWithMessageCandidateTypeDecorator(IGetsCandidateMessageTypes)
Initialises a new instance of RuleWithMessageCandidateTypeDecorator.
Declaration
public RuleWithMessageCandidateTypeDecorator(IGetsCandidateMessageTypes wrapped)
Parameters
Type | Name | Description |
---|---|---|
IGetsCandidateMessageTypes | wrapped | The wrapped candidate message type provider. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | If |
Methods
| Improve this Doc View SourceGetCandidateMessageProviderTypes(ValidationRuleResult)
Gets a collection of message provider types from the registry which are candidates to provide a message for the specified validation rule result.
Declaration
public IEnumerable<MessageProviderTypeInfo> GetCandidateMessageProviderTypes(ValidationRuleResult result)
Parameters
Type | Name | Description |
---|---|---|
ValidationRuleResult | result | A validation rule result. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<MessageProviderTypeInfo> | A collection of candidate message provider types and their priority. |
Remarks
This method does not take into account the CanGetFailureMessage(ValidationRuleResult) method, or any of the equivalent methods upon IHasFailureMessageUsageCriteria<TValidated> or IHasFailureMessageUsageCriteria<TValidated, TParent>. This method only filters/selects candidate types based upon the FailureMessageStrategyAttribute and the predicate values stored there.
Further logic should be executed afterward to determine whether or not the type information provided is suitable to select as the message provider for the specified validation rule result.