Class CommandRefusal

Namespace
Cratis.Arc.Commands
Assembly
Cratis.Arc.Core.dll

Describes why a command was refused without treating retryable or infrastructure failures as refusals.

public record CommandRefusal : IEquatable<CommandRefusal>
Inheritance
CommandRefusal
Implements
Inherited Members
Extension Methods

Constructors

CommandRefusal(CommandRefusal)

protected CommandRefusal(CommandRefusal original)

Parameters

original CommandRefusal

CommandRefusal(CommandRefusalKind, string?, string)

Describes why a command was refused without treating retryable or infrastructure failures as refusals.

public CommandRefusal(CommandRefusalKind Kind, string? ConstraintName, string Message)

Parameters

Kind CommandRefusalKind

The refusal category.

ConstraintName string

The violated constraint name, when available for a constraint refusal.

Message string

The authored refusal messages, verbatim and joined with a newline.

Properties

ConstraintName

Gets the first violated constraint name, or null when no names are available.

public string? ConstraintName { get; }

Property Value

string

ConstraintNames

Gets all violated constraint names in result order, without duplicates.

public IReadOnlyList<string> ConstraintNames { get; init; }

Property Value

IReadOnlyList<string>

EqualityContract

protected virtual Type EqualityContract { get; }

Property Value

Type

Kind

The refusal category.

public CommandRefusalKind Kind { get; init; }

Property Value

CommandRefusalKind

Message

The authored refusal messages, verbatim and joined with a newline.

public string Message { get; init; }

Property Value

string

Methods

Deconstruct(out CommandRefusalKind, out string?, out string)

public void Deconstruct(out CommandRefusalKind Kind, out string? ConstraintName, out string Message)

Parameters

Kind CommandRefusalKind
ConstraintName string
Message string

Equals(CommandRefusal?)

Compares refusals by their kind, authored message and ordered constraint names.

public virtual bool Equals(CommandRefusal? other)

Parameters

other CommandRefusal

The refusal to compare.

Returns

bool

Whether both refusals describe the same outcome.

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

PrintMembers(StringBuilder)

protected virtual bool PrintMembers(StringBuilder builder)

Parameters

builder StringBuilder

Returns

bool

ToString()

public override string ToString()

Returns

string

Operators

operator ==(CommandRefusal?, CommandRefusal?)

public static bool operator ==(CommandRefusal? left, CommandRefusal? right)

Parameters

left CommandRefusal
right CommandRefusal

Returns

bool

operator !=(CommandRefusal?, CommandRefusal?)

public static bool operator !=(CommandRefusal? left, CommandRefusal? right)

Parameters

left CommandRefusal
right CommandRefusal

Returns

bool