Show / Hide Table of Contents

Class FailureMessageProviderSelector

A service which can get the appropriate failure message provider for a specified ValidationRuleResult.

Inheritance
System.Object
FailureMessageProviderSelector
Implements
IGetsFailureMessageProvider
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: CSF.Validation.Messages
Assembly: CSF.Validation.dll
Syntax
public class FailureMessageProviderSelector : IGetsFailureMessageProvider

Constructors

| Improve this Doc View Source

FailureMessageProviderSelector(IGetsMessageProviderInfoFactory)

Initialises a new instance of FailureMessageProviderSelector.

Declaration
public FailureMessageProviderSelector(IGetsMessageProviderInfoFactory providerInfoFactoryFactory)
Parameters
Type Name Description
IGetsMessageProviderInfoFactory providerInfoFactoryFactory

A factory service that gets the message provider info factory.

Exceptions
Type Condition
System.ArgumentNullException

If providerInfoFactoryFactory is null.

Methods

| Improve this Doc View Source

GetProvider(ValidationRuleResult)

Gets the most appropriate message provider implementation for getting a feedback message for the specified ValidationRuleResult.

Declaration
public IGetsFailureMessage GetProvider(ValidationRuleResult ruleResult)
Parameters
Type Name Description
ValidationRuleResult ruleResult

The validation rule result for which to get a message provider.

Returns
Type Description
IGetsFailureMessage

Either an implementation of IGetsFailureMessage, or a null reference, if no message provider is suitable for the result.

Remarks

This method uses an instance of IGetsMessageProviderInfo to get a collection of candidate MessageProviderInfo instances which could provide a message for the specified rule result. Once the message provider infos are retrieved, the provider with the highest numeric Priority is selected and its MessageProvider implementation is returned as the result of this method.

If this method returns a null reference then this indicates that there is no message provider suitable for providing the message for the specified rule result. If the IGetsMessageProviderInfo returned more than one MessageProviderInfo which are tied for the highest priority then any of these may be returned by this method, and results might not be stable. Developers are encouraged to avoid message providers with tied priorities.

The instance of IGetsMessageProviderInfo used is retrieved using a IGetsMessageProviderInfoFactory.

See Also
IGetsMessageProviderInfoFactory
IGetsMessageProviderInfo
MessageProviderInfo
MessageProviderTypeInfo
MessageProviderInfoFactory
NullExcludingMessageProviderInfoDecorator
CriteriaApplyingMessageProviderInfoDecorator

Implements

IGetsFailureMessageProvider
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX