Table of Contents

Class MessageResult

Namespace
Excalibur.Dispatch
Assembly
Excalibur.Dispatch.Abstractions.dll

Static factory methods for creating message results.

public static class MessageResult
Inheritance
MessageResult
Inherited Members

Methods

Cancelled()

Creates a cancelled message result.

public static IMessageResult Cancelled()

Returns

IMessageResult

A cancelled message result indicating the operation was cancelled.

Cancelled<T>()

Creates a cancelled message result with a generic type parameter. Returns a cached instance per type parameter to avoid unnecessary allocations.

public static IMessageResult<T> Cancelled<T>()

Returns

IMessageResult<T>

A cancelled message result.

Type Parameters

T

The type of the expected return value.

Failed(IMessageProblemDetails)

Creates a failed message result with problem details.

public static IMessageResult Failed(IMessageProblemDetails problemDetails)

Parameters

problemDetails IMessageProblemDetails

The problem details.

Returns

IMessageResult

A failed message result.

Failed(IMessageProblemDetails?, object?, object?)

Creates a failed message result with problem details and additional context.

public static IMessageResult Failed(IMessageProblemDetails? problemDetails, object? validationResult, object? authorizationResult)

Parameters

problemDetails IMessageProblemDetails

The problem details.

validationResult object

The validation result.

authorizationResult object

The authorization result.

Returns

IMessageResult

A failed message result.

Failed(Exception)

Creates a failed message result from an exception, preserving the full exception detail.

public static IMessageResult Failed(Exception exception)

Parameters

exception Exception

The exception that caused the failure.

Returns

IMessageResult

A failed message result.

Failed(string)

Creates a failed message result.

public static IMessageResult Failed(string error)

Parameters

error string

The error message.

Returns

IMessageResult

A failed message result.

Failed<T>(Exception)

Creates a failed message result with a generic type parameter from an exception, preserving the full exception detail.

public static IMessageResult<T> Failed<T>(Exception exception)

Parameters

exception Exception

The exception that caused the failure.

Returns

IMessageResult<T>

A failed message result.

Type Parameters

T

The type of the expected return value.

Failed<T>(string?, IMessageProblemDetails?)

Creates a failed message result with a generic type parameter.

public static IMessageResult<T> Failed<T>(string? errorMessage, IMessageProblemDetails? problemDetails = null)

Parameters

errorMessage string

The error message.

problemDetails IMessageProblemDetails

The problem details.

Returns

IMessageResult<T>

A failed message result.

Type Parameters

T

The type of the expected return value.

Success()

Creates a successful message result.

public static IMessageResult Success()

Returns

IMessageResult

A successful message result.

Success(RoutingDecision?, object?, object?, MessageDisposition)

Creates a successful message result with additional parameters.

public static IMessageResult Success(RoutingDecision? routingDecision, object? validationResult, object? authorizationResult, MessageDisposition disposition = MessageDisposition.Handled)

Parameters

routingDecision RoutingDecision

The routing decision.

validationResult object

The validation result.

authorizationResult object

The authorization result.

disposition MessageDisposition

Describes how the result was produced.

Returns

IMessageResult

A successful message result.

SuccessFromCache()

Creates a successful message result with cache hit.

public static IMessageResult SuccessFromCache()

Returns

IMessageResult

A successful message result from cache.

SuccessFromCache<T>(T)

Creates a successful message result with a value from cache.

public static IMessageResult<T> SuccessFromCache<T>(T value)

Parameters

value T

The cached value to return.

Returns

IMessageResult<T>

A successful message result with value indicating cache hit.

Type Parameters

T

The type of the value.

Success<T>(T)

Creates a successful message result with a value.

public static IMessageResult<T> Success<T>(T value)

Parameters

value T

The value to return.

Returns

IMessageResult<T>

A successful message result with value.

Type Parameters

T

The type of the value.

Success<T>(T, RoutingDecision?, object?, object?, MessageDisposition)

Creates a successful message result with a value and full context.

public static IMessageResult<T> Success<T>(T value, RoutingDecision? routingDecision = null, object? validationResult = null, object? authorizationResult = null, MessageDisposition disposition = MessageDisposition.Handled)

Parameters

value T

The value to return.

routingDecision RoutingDecision

The routing decision.

validationResult object

The validation result.

authorizationResult object

The authorization result.

disposition MessageDisposition

Describes how the result was produced.

Returns

IMessageResult<T>

A successful message result with value.

Type Parameters

T

The type of the value.