Class FailureMessageProviderAdapter<TValidated>
Adapter which allows a IGetsFailureMessage<TValidated> to be used as a IGetsFailureMessage.
Inheritance
System.Object
FailureMessageProviderAdapter<TValidated>
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> : IGetsFailureMessage, IHasWrappedFailureMessageProvider
Type Parameters
Name | Description |
---|---|
TValidated | The validated type. |
Constructors
| Improve this Doc View SourceFailureMessageProviderAdapter(IGetsFailureMessage<TValidated>)
Initialises a new instance of FailureMessageProviderAdapter<TValidated>.
Declaration
public FailureMessageProviderAdapter(IGetsFailureMessage<TValidated> wrapped)
Parameters
Type | Name | Description |
---|---|---|
IGetsFailureMessage<TValidated> | 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. |