| | | 1 | | namespace AsiBackbone.Core.Outbox; |
| | | 2 | | |
| | | 3 | | /// <summary> |
| | | 4 | | /// Represents the caller-visible result of a claimed outbox transition attempt. |
| | | 5 | | /// </summary> |
| | | 6 | | public sealed class GovernanceOutboxClaimTransitionResult |
| | | 7 | | { |
| | 26 | 8 | | private GovernanceOutboxClaimTransitionResult( |
| | 26 | 9 | | GovernanceOutboxEntry entry, |
| | 26 | 10 | | GovernanceOutboxClaimTransitionOutcome outcome) |
| | | 11 | | { |
| | 26 | 12 | | ArgumentNullException.ThrowIfNull(entry); |
| | | 13 | | |
| | 24 | 14 | | if (!Enum.IsDefined(outcome)) |
| | | 15 | | { |
| | 2 | 16 | | throw new ArgumentOutOfRangeException(nameof(outcome), outcome, "Claim transition outcome must be defined.") |
| | | 17 | | } |
| | | 18 | | |
| | 22 | 19 | | Entry = entry; |
| | 22 | 20 | | Outcome = outcome; |
| | 22 | 21 | | } |
| | | 22 | | |
| | | 23 | | /// <summary> |
| | | 24 | | /// Gets the durable entry observed after the transition attempt, or the caller's last safe snapshot when the row is |
| | | 25 | | /// </summary> |
| | 34 | 26 | | public GovernanceOutboxEntry Entry { get; } |
| | | 27 | | |
| | | 28 | | /// <summary> |
| | | 29 | | /// Gets the explicit transition outcome. |
| | | 30 | | /// </summary> |
| | 44 | 31 | | public GovernanceOutboxClaimTransitionOutcome Outcome { get; } |
| | | 32 | | |
| | | 33 | | /// <summary> |
| | | 34 | | /// Gets a value indicating whether this invocation persisted the requested transition. |
| | | 35 | | /// </summary> |
| | 22 | 36 | | public bool IsApplied => Outcome is GovernanceOutboxClaimTransitionOutcome.Applied; |
| | | 37 | | |
| | | 38 | | /// <summary> |
| | | 39 | | /// Creates a claimed transition result. |
| | | 40 | | /// </summary> |
| | | 41 | | public static GovernanceOutboxClaimTransitionResult Create( |
| | | 42 | | GovernanceOutboxEntry entry, |
| | | 43 | | GovernanceOutboxClaimTransitionOutcome outcome) |
| | | 44 | | { |
| | 26 | 45 | | return new GovernanceOutboxClaimTransitionResult(entry, outcome); |
| | | 46 | | } |
| | | 47 | | } |