dotnet-cqrs/Svrnty.CQRS.Events.Abstractions/Models/CommandResultWithCorrelation.cs

21 lines
788 B
C#

namespace Svrnty.CQRS.Events.Abstractions.Models;
/// <summary>
/// Wraps a command result with the correlation ID assigned by the framework.
/// Use this when you need to return the correlation ID to the caller (e.g., for multi-step workflows).
/// </summary>
/// <typeparam name="TResult">The type of the command result.</typeparam>
public sealed record CommandResultWithCorrelation<TResult>
{
/// <summary>
/// The result of the command execution.
/// </summary>
public required TResult Result { get; init; }
/// <summary>
/// The correlation ID assigned by the framework to all events emitted by this command.
/// Use this to link follow-up commands to the same workflow/saga.
/// </summary>
public required string CorrelationId { get; init; }
}