Interface IActionableResult<TValue, TResult>
- Namespace
- LightResults.Common
- Assembly
- LightResults.dll
Defines an actionable result.
public interface IActionableResult<TValue, out TResult> : IResult<TValue>, IResult where TResult : IResult<TValue>Type Parameters
TValueTResult
Implements
Methods
Failure()
Creates a failure result.
public static abstract TResult Failure()Returns
- TResult
-
A new instance of
TResultrepresenting a failure result.
Failure(string)
Creates a failure result with the given error message.
public static abstract TResult Failure(string errorMessage)Parameters
errorMessagestring-
The error message associated with the failure.
Returns
- TResult
-
A new instance of
TResultrepresenting a failure result with the specified error message.
Failure(string, (string Key, object? Value))
Creates a failure result with the given error message and metadata.
public static abstract TResult Failure(string errorMessage, (string Key, object? Value) metadata)Parameters
errorMessagestring-
The error message associated with the failure.
metadata(string Key, object? Value)-
The metadata associated with the failure.
Returns
- TResult
-
A new instance of
TResultrepresenting a failure result with the specified error message and metadata.
Failure(string, KeyValuePair<string, object?>)
Creates a failure result with the given error message and metadata.
public static abstract TResult Failure(string errorMessage, KeyValuePair<string, object?> metadata)Parameters
errorMessagestring-
The error message associated with the failure.
metadataKeyValuePair<string, object?>-
The metadata associated with the failure.
Returns
- TResult
-
A new instance of
TResultrepresenting a failure result with the specified error message and metadata.
Failure(string, IReadOnlyDictionary<string, object?>)
Creates a failure result with the given error message and metadata.
public static abstract TResult Failure(string errorMessage, IReadOnlyDictionary<string, object?> metadata)Parameters
errorMessagestring-
The error message associated with the failure.
metadataIReadOnlyDictionary<string, object?>-
The metadata associated with the failure.
Returns
- TResult
-
A new instance of
TResultrepresenting a failure result with the specified error message and metadata.
Failure(Exception?)
Creates a failure result with the given exception.
public static abstract TResult Failure(Exception? ex)Parameters
exException?-
The System.Exception associated with the failure, if any.
Returns
- TResult
-
A new instance of LightResults.Result representing a failure result with the specified exception.
Remarks
The exception is added to the error LightResults.Error.Metadata under the key of "Exception" and the error LightResults.Error.Message is set to that of the exception.
Failure(string, Exception?)
Creates a failure result with the given error message and exception.
public static abstract TResult Failure(string errorMessage, Exception? ex)Parameters
errorMessagestring-
The error message associated with the failure.
exException?-
The System.Exception associated with the failure, if any.
Returns
- TResult
-
A new instance of LightResults.Result representing a failure result with the specified error message and exception.
Remarks
The exception is added to the error LightResults.Error.Metadata under the key of "Exception".
Failure(IError)
Creates a failure result with the given error.
public static abstract TResult Failure(IError error)Parameters
errorIError-
The error associated with the failure.
Returns
- TResult
-
A new instance of
TResultrepresenting a failure result with the specified error.
Failure(IEnumerable<IError>)
Creates a failure result with the given errors.
public static abstract TResult Failure(IEnumerable<IError> errors)Parameters
errorsIEnumerable<IError>-
A collection of errors associated with the failure.
Returns
- TResult
-
A new instance of
TResultrepresenting a failure result with the specified errors.
Failure(IReadOnlyList<IError>)
Creates a failure result with the given errors.
public static abstract TResult Failure(IReadOnlyList<IError> errors)Parameters
errorsIReadOnlyList<IError>-
A collection of errors associated with the failure.
Returns
- TResult
-
A new instance of
TResultrepresenting a failure result with the specified errors.
Success(TValue)
Creates a success result with the given value.
public static abstract TResult Success(TValue value)Parameters
valueTValue-
The value to include in the result.
Returns
- TResult
-
A new instance of
TResultrepresenting a success result with the specified value.