LinKit.Sagas 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package LinKit.Sagas --version 1.0.0
                    
NuGet\Install-Package LinKit.Sagas -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="LinKit.Sagas" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="LinKit.Sagas" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="LinKit.Sagas" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add LinKit.Sagas --version 1.0.0
                    
#r "nuget: LinKit.Sagas, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package LinKit.Sagas@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=LinKit.Sagas&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=LinKit.Sagas&version=1.0.0
                    
Install as a Cake Tool

LinKit.Sagas

NuGet Version NuGet Downloads

LinKit.Sagas delivers high-performance, Zero-Reflection, and Native AOT compatible Distributed Saga Orchestration with automated compensation workflows for LinKit.


🚀 Key Features

  • Zero Reflection & Native AOT Ready: 100% Native AOT & Trimming safe with compile-time type dispatch and zero runtime reflection.
  • Automated Compensation: Automatic backward compensation execution (CompensateAsync) if any forward saga step (ExecuteAsync) throws an exception.
  • State Persistence: Supports state transitions and correlation tracking via ISagaRepository<TData>. Comes with high-performance InMemorySagaRepository<TData> with easy hooks for EF Core / MongoDB / Redis.
  • Correlation Tracking: End-to-end distributed tracking using CorrelationId and CurrentState.

📦 Installation

dotnet add package LinKit.Sagas

🛠️ Usage Guide

1. Define Saga State Data

using LinKit.Sagas;

public class OrderSagaData : SagaData
{
    public Guid OrderId { get; set; }
    public decimal Amount { get; set; }
}

2. Define Saga Steps with Forward & Compensation Logic

using LinKit.Sagas;

public class ProcessPaymentSagaStep : ISagaStep<OrderSagaData, ProcessPaymentEvent>
{
    private readonly IPaymentService _paymentService;

    public ProcessPaymentSagaStep(IPaymentService paymentService)
    {
        _paymentService = paymentService;
    }

    public async Task ExecuteAsync(OrderSagaData data, ProcessPaymentEvent @event, CancellationToken ct)
    {
        // 1. Forward action
        await _paymentService.ChargeAsync(data.OrderId, data.Amount, ct);
    }

    public async Task CompensateAsync(OrderSagaData data, ProcessPaymentEvent @event, CancellationToken ct)
    {
        // 2. Backward compensation action if subsequent steps fail
        await _paymentService.RefundAsync(data.OrderId, data.Amount, ct);
    }
}

3. Register Sagas & Coordinate Execution

using LinKit.Sagas;

var builder = WebApplication.CreateBuilder(args);

// Register Saga infrastructure
builder.Services.AddLinKitSagas<OrderSagaData>();
builder.Services.AddScoped<ProcessPaymentSagaStep>();

var app = builder.Build();

// Execute a step via SagaCoordinator
var coordinator = app.Services.GetRequiredService<SagaCoordinator<OrderSagaData>>();
var step = app.Services.GetRequiredService<ProcessPaymentSagaStep>();

await coordinator.ExecuteStepAsync(
    correlationId: Guid.NewGuid(),
    @event: new ProcessPaymentEvent(),
    step: step,
    nextState: "PaymentProcessed"
);

📄 License

Licensed under the MIT License.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.2.1 72 10/31/2026
1.2.0 69 10/30/2026
1.1.0 109 10/22/2026
1.0.0 114 10/20/2026