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
ExceptionMessages
Gets or sets any exception messages that might have occurred.
public IEnumerable<string> ExceptionMessages { get; set; }
Property Value
ExceptionStackTrace
Gets or sets the stack trace if there was an exception.
public string ExceptionStackTrace { get; set; }
Property Value
HasExceptions
Gets or sets whether or not there are any exceptions that occurred.
public bool HasExceptions { get; }
Property Value
IsAuthorized
Gets whether or not the command was authorized to execute.
public bool IsAuthorized { get; set; }
Property Value
IsSuccess
Gets whether or not the command executed successfully.
public bool IsSuccess { get; }
Property Value
IsValid
Gets whether or not the command is valid.
public bool IsValid { get; }
Property Value
ValidationResults
Gets or sets any validation result.
public IEnumerable<ValidationResult> ValidationResults { get; set; }
Property Value
Methods
Error(CorrelationId, Exception)
Creates a new CommandResult representing an error.
public static CommandResult Error(CorrelationId correlationId, Exception exception)
Parameters
correlationIdCorrelationIdThe CorrelationId associated with the command.
exceptionExceptionThe exception.
Returns
Error(CorrelationId, string)
Creates a new CommandResult representing an error.
public static CommandResult Error(CorrelationId correlationId, string message)
Parameters
correlationIdCorrelationIdThe CorrelationId associated with the command.
messagestringThe error message.
Returns
MergeWith(params CommandResult[])
Merges the results of one or more CommandResult instances into this.
public void MergeWith(params CommandResult[] commandResults)
Parameters
commandResultsCommandResult[]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
correlationIdCorrelationIdThe CorrelationId associated with the command.
typeTypeThe type of command that is missing a handler.
Returns
Success(CorrelationId)
Creates a new CommandResult representing a successful command execution.
public static CommandResult Success(CorrelationId correlationId)
Parameters
correlationIdCorrelationIdThe CorrelationId associated with the command.
Returns
Unauthorized(CorrelationId)
Creates a new CommandResult representing an unauthorized command execution.
public static CommandResult Unauthorized(CorrelationId correlationId)
Parameters
correlationIdCorrelationIdThe CorrelationId associated with the command.