Table of Contents

Class CommandResult

Namespace
Cratis.Applications.Commands
Assembly
Cratis.Applications.dll

Represents the result coming from executing a command.

public class CommandResult
Inheritance
CommandResult
Derived
Inherited Members
Extension Methods

Properties

CorrelationId

Gets the CorrelationId associated with the command.

public CorrelationId CorrelationId { get; init; }

Property Value

CorrelationId

ExceptionMessages

Gets or sets any exception messages that might have occurred.

public IEnumerable<string> ExceptionMessages { get; set; }

Property Value

IEnumerable<string>

ExceptionStackTrace

Gets or sets the stack trace if there was an exception.

public string ExceptionStackTrace { get; set; }

Property Value

string

HasExceptions

Gets or sets whether or not there are any exceptions that occurred.

public bool HasExceptions { get; }

Property Value

bool

IsAuthorized

Gets whether or not the command was authorized to execute.

public bool IsAuthorized { get; set; }

Property Value

bool

IsSuccess

Gets whether or not the command executed successfully.

public bool IsSuccess { get; }

Property Value

bool

IsValid

Gets whether or not the command is valid.

public bool IsValid { get; }

Property Value

bool

ValidationResults

Gets or sets any validation result.

public IEnumerable<ValidationResult> ValidationResults { get; set; }

Property Value

IEnumerable<ValidationResult>

Methods

Error(CorrelationId, Exception)

Creates a new CommandResult representing an error.

public static CommandResult Error(CorrelationId correlationId, Exception exception)

Parameters

correlationId CorrelationId

The CorrelationId associated with the command.

exception Exception

The exception.

Returns

CommandResult

A CommandResult.

Error(CorrelationId, string)

Creates a new CommandResult representing an error.

public static CommandResult Error(CorrelationId correlationId, string message)

Parameters

correlationId CorrelationId

The CorrelationId associated with the command.

message string

The error message.

Returns

CommandResult

A CommandResult.

MergeWith(params CommandResult[])

Merges the results of one or more CommandResult instances into this.

public void MergeWith(params CommandResult[] commandResults)

Parameters

commandResults CommandResult[]

Params of CommandResult to merge with.

MissingHandler(CorrelationId, Type)

Creates a new CommandResult representing a missing handler.

public static CommandResult MissingHandler(CorrelationId correlationId, Type type)

Parameters

correlationId CorrelationId

The CorrelationId associated with the command.

type Type

The type of command that is missing a handler.

Returns

CommandResult

A CommandResult.

Success(CorrelationId)

Creates a new CommandResult representing a successful command execution.

public static CommandResult Success(CorrelationId correlationId)

Parameters

correlationId CorrelationId

The CorrelationId associated with the command.

Returns

CommandResult

A CommandResult.

Unauthorized(CorrelationId)

Creates a new CommandResult representing an unauthorized command execution.

public static CommandResult Unauthorized(CorrelationId correlationId)

Parameters

correlationId CorrelationId

The CorrelationId associated with the command.

Returns

CommandResult

A CommandResult.