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
TValue
TResult
Implements
Methods
Failure()
Creates a failure result.
public static abstract TResult Failure()
Returns
- TResult
-
A new instance of
TResult
representing a failure result.
Failure(string)
Creates a failure result with the given error message.
public static abstract TResult Failure(string errorMessage)
Parameters
errorMessage
string-
The error message associated with the failure.
Returns
- TResult
-
A new instance of
TResult
representing 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
errorMessage
string-
The error message associated with the failure.
metadata
(string Key, object? Value)-
The metadata associated with the failure.
Returns
- TResult
-
A new instance of
TResult
representing 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
errorMessage
string-
The error message associated with the failure.
metadata
KeyValuePair<string, object?>-
The metadata associated with the failure.
Returns
- TResult
-
A new instance of
TResult
representing 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
errorMessage
string-
The error message associated with the failure.
metadata
IReadOnlyDictionary<string, object?>-
The metadata associated with the failure.
Returns
- TResult
-
A new instance of
TResult
representing 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
ex
Exception?-
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
errorMessage
string-
The error message associated with the failure.
ex
Exception?-
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
error
IError-
The error associated with the failure.
Returns
- TResult
-
A new instance of
TResult
representing 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
errors
IEnumerable<IError>-
A collection of errors associated with the failure.
Returns
- TResult
-
A new instance of
TResult
representing 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
errors
IReadOnlyList<IError>-
A collection of errors associated with the failure.
Returns
- TResult
-
A new instance of
TResult
representing 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
value
TValue-
The value to include in the result.
Returns
- TResult
-
A new instance of
TResult
representing a success result with the specified value.