Interface IGetsCandidateMessageTypes
An object which is used to get type information about message provider types which could potentially provide the message for a specified validation rule result.
Namespace: CSF.Validation.Messages
Assembly: CSF.Validation.Abstractions.dll
Syntax
public interface IGetsCandidateMessageTypes
Remarks
A message provider service is class which implements one of the following interfaces. It is OK if a single class implements more of these interfaces. It is also acceptable if it implements more than one closed generic form of either (or both) of the generic interfaces.
The class may optionally also implement any (or all) of the following, again perhaps implementing multiple closed generic forms of the same generic interface an unlimited number of times.
- IHasFailureMessageUsageCriteria
- IHasFailureMessageUsageCriteria<TValidated>
- IHasFailureMessageUsageCriteria<TValidated, TParent>
The implementation of this service should be registered in dependency injection as a singleton.
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
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.