Class FailureMessageProviderAdapter<TValidated, TParent>
Adapter which allows a IGetsFailureMessage<TValidated, TParent> to be used as a IGetsFailureMessage.
Inheritance
System.Object
FailureMessageProviderAdapter<TValidated, TParent>
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 FailureMessageProviderAdapter<TValidated, TParent> : IGetsFailureMessage, IHasWrappedFailureMessageProvider
Type Parameters
Name | Description |
---|---|
TValidated | The validated type. |
TParent | The parent validated type. |
Constructors
| Improve this Doc View SourceFailureMessageProviderAdapter(IGetsFailureMessage<TValidated, TParent>)
Initialises a new instance of FailureMessageProviderAdapter<TValidated, TParent>.
Declaration
public FailureMessageProviderAdapter(IGetsFailureMessage<TValidated, TParent> wrapped)
Parameters
Type | Name | Description |
---|---|---|
IGetsFailureMessage<TValidated, TParent> | wrapped | The wrapped service. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | If |
Methods
| Improve this Doc View SourceGetFailureMessageAsync(ValidationRuleResult, CancellationToken)
Gets the validation failure message for the specified result.
Declaration
public ValueTask<string> GetFailureMessageAsync(ValidationRuleResult result, CancellationToken token = default(CancellationToken))
Parameters
Type | Name | Description |
---|---|---|
ValidationRuleResult | result | A validation result, typically indicating failure. |
System.Threading.CancellationToken | token | An optional cancellation token. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.ValueTask<System.String> | A human-readable message. |
GetWrappedProvider()
Gets a reference to the wrapped failure message provider instance.
Declaration
public object GetWrappedProvider()
Returns
Type | Description |
---|---|
System.Object | The wrapped failure message provider. |