Microsoft.Orleans.Transactions.AzureStorage 9.2.0-preview2

Prefix Reserved
This is a prerelease version of Microsoft.Orleans.Transactions.AzureStorage.
There is a newer version of this package available.
See the version list below for details.
dotnet add package Microsoft.Orleans.Transactions.AzureStorage --version 9.2.0-preview2
                    
NuGet\Install-Package Microsoft.Orleans.Transactions.AzureStorage -Version 9.2.0-preview2
                    
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="Microsoft.Orleans.Transactions.AzureStorage" Version="9.2.0-preview2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Microsoft.Orleans.Transactions.AzureStorage" Version="9.2.0-preview2" />
                    
Directory.Packages.props
<PackageReference Include="Microsoft.Orleans.Transactions.AzureStorage" />
                    
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 Microsoft.Orleans.Transactions.AzureStorage --version 9.2.0-preview2
                    
#r "nuget: Microsoft.Orleans.Transactions.AzureStorage, 9.2.0-preview2"
                    
#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 Microsoft.Orleans.Transactions.AzureStorage@9.2.0-preview2
                    
#: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=Microsoft.Orleans.Transactions.AzureStorage&version=9.2.0-preview2&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Microsoft.Orleans.Transactions.AzureStorage&version=9.2.0-preview2&prerelease
                    
Install as a Cake Tool

Microsoft Orleans Transactions for Azure Storage

Introduction

Microsoft Orleans Transactions for Azure Storage provides the infrastructure to store Orleans transaction logs in Azure Storage. This package allows Orleans applications to use ACID transactions across multiple grain calls with Azure Storage as the backing transaction log store.

Getting Started

To use this package, install it via NuGet:

dotnet add package Microsoft.Orleans.Transactions.AzureStorage

Example - Configuring Azure Storage for Transactions

using Microsoft.Extensions.Hosting;
using Orleans.Configuration;
using Orleans.Hosting;
using Orleans.Transactions;

var builder = Host.CreateApplicationBuilder(args)
    .UseOrleans(siloBuilder =>
    {
        siloBuilder
            .UseLocalhostClustering()
            // Enable transactions
            .AddAzureTableTransactionalStateStorage(
                name: "TransactionStore",
                configureOptions: options =>
                {
                    options.ConnectionString = "YOUR_AZURE_STORAGE_CONNECTION_STRING";
                })
            .UseTransactions();
    });

// Run the host
await builder.RunAsync();

Example - Using Transactions in Grains

// A grain with transactional state
public class MyTransactionalGrain : Grain, IMyTransactionalGrain
{
    private readonly ITransactionalState<MyState> _state;

    // Inject the transactional state
    public MyTransactionalGrain(
        [TransactionalState("state", "TransactionStore")]
        ITransactionalState<MyState> state)
    {
        _state = state;
    }

    // Method that performs a transaction
    [Transaction(TransactionOption.Create)]
    public async Task Transfer(string otherGrainKey, int amount)
    {
        // Read our state within the transaction
        var myState = await _state.PerformRead(state => state);
        
        // Ensure we have enough balance
        if (myState.Balance < amount)
            throw new InvalidOperationException("Insufficient funds");
            
        // Update our state within the transaction
        await _state.PerformUpdate(s => s.Balance -= amount);
        
        // Call another grain within the same transaction
        var otherGrain = GrainFactory.GetGrain<IMyTransactionalGrain>(otherGrainKey);
        await otherGrain.Deposit(amount);
    }

    // Method that participates in a transaction
    [Transaction(TransactionOption.Join)]
    public Task Deposit(int amount)
    {
        // Update state within the joined transaction
        return _state.PerformUpdate(s => s.Balance += amount);
    }

    // Read operation within a transaction
    [Transaction(TransactionOption.CreateOrJoin)]
    public Task<int> GetBalance()
    {
        return _state.PerformRead(s => s.Balance);
    }
}

// State class

public class MyState
{
    public int Balance { get; set; }
}

Documentation

For more comprehensive documentation, please refer to:

Feedback & Contributing

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 was computed.  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 was computed.  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 (1)

Showing the top 1 NuGet packages that depend on Microsoft.Orleans.Transactions.AzureStorage:

Package Downloads
Microsoft.Orleans.Transactions.TestKit.Base

Testkit base library for transactions

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on Microsoft.Orleans.Transactions.AzureStorage:

Repository Stars
Dotnet-Boxed/Templates
.NET project templates with batteries included, providing the minimum amount of code required to get you going faster.
Version Downloads Last Updated
9.2.1 1,333 7/16/2025
9.2.0 361 7/14/2025
9.2.0-preview3 377 6/10/2025
9.2.0-preview2 213 6/4/2025
9.2.0-preview1 191 4/4/2025
9.1.2 3,651 2/13/2025
9.0.1 1,514 11/23/2024
9.0.0 485 11/14/2024
8.2.0 11,871 7/12/2024
8.2.0-preview1 244 5/22/2024
8.1.0 4,564 4/17/2024
8.1.0-preview3 291 3/11/2024
8.1.0-preview2 274 2/23/2024
8.1.0-preview1 334 2/13/2024
8.0.0 1,361 1/5/2024
8.0.0-rc2 523 12/20/2023
8.0.0-rc1 478 12/4/2023
7.2.7 350 10/15/2024
7.2.6 587 3/9/2024
7.2.5 2,910 2/22/2024
7.2.4 2,201 12/2/2023
7.2.3 802 11/3/2023
7.2.2 3,412 10/16/2023
7.2.1 8,915 7/11/2023
7.2.0 879 7/7/2023
7.1.2 23,093 4/19/2023
7.1.1 1,113 3/23/2023
7.1.0 1,628 2/1/2023
7.0.0 6,140 11/8/2022
7.0.0-rc2 735 10/19/2022
4.0.0-preview2 820 8/4/2022
4.0.0-preview1 1,158 2/10/2022
3.8.0 329 5/6/2025
3.8.0-preview5 314 5/12/2025
3.8.0-preview3 285 4/8/2025
3.8.0-preview2 256 4/4/2025
3.8.0-preview1 307 3/31/2025
3.7.2 407 5/10/2024
3.7.1 16,719 5/27/2023
3.7.0 1,607 3/23/2023
3.6.5 42,327 8/15/2022
3.6.4 2,000 8/10/2022
3.6.3 3,107 8/4/2022
3.6.2 11,012 4/15/2022
3.6.1 2,265 4/5/2022
3.6.0 26,126 1/20/2022
3.5.1 9,305 11/8/2021
3.5.0 15,080 9/3/2021
3.4.4 2,212 10/4/2021
3.4.3 14,658 6/3/2021
3.4.2 9,406 4/5/2021
3.4.1 10,510 2/3/2021
3.4.0 4,609 1/6/2021
3.4.0-rc1 1,455 12/9/2020
3.3.0 12,896 9/9/2020
3.3.0-rc2 1,612 9/2/2020
3.3.0-rc1 1,547 8/19/2020
3.2.2 6,396 7/22/2020
3.2.1 5,613 7/2/2020
3.2.0 3,405 6/4/2020
3.2.0-rc2 1,443 5/20/2020
3.2.0-rc1 1,757 5/7/2020
3.1.7 2,635 5/19/2020
3.1.6 2,716 4/16/2020
3.1.5 2,222 4/9/2020
3.1.4 4,717 3/26/2020
3.1.3 2,768 3/16/2020
3.1.2 2,793 3/5/2020
3.1.0 2,394 2/23/2020
3.1.0-rc3 1,580 2/13/2020
3.1.0-rc2 1,542 2/12/2020
3.1.0-rc1 1,596 2/10/2020
3.0.2 4,360 12/12/2019
3.0.1 3,593 11/27/2019
3.0.0 2,432 10/24/2019
3.0.0-rc2 1,689 10/16/2019
3.0.0-rc1 1,693 10/9/2019
3.0.0-beta1 1,569 8/16/2019
2.4.5 4,974 12/29/2019
2.4.4 2,212 11/27/2019
2.4.3 2,359 10/10/2019
2.4.2 4,322 8/31/2019
2.4.1 2,454 8/14/2019
2.4.0 3,966 8/8/2019
2.3.6 2,982 7/24/2019
2.3.5 2,853 6/14/2019
2.3.4 2,440 6/4/2019
2.3.3 2,390 6/2/2019
2.3.2 2,301 5/9/2019
2.3.1 2,507 4/26/2019
2.3.0 2,811 3/20/2019
2.3.0-rc2 1,604 3/13/2019
2.3.0-rc1 1,716 3/4/2019
2.2.4 1,795 2/25/2019
2.2.3 1,804 1/17/2019
2.2.2 2,420 1/10/2019
2.2.0 1,883 12/13/2018
2.2.0-rc1 1,571 12/4/2018
2.2.0-beta1 1,620 10/21/2018
2.1.2 1,938 10/11/2018
2.1.0 2,135 9/28/2018
2.1.0-rc2 1,794 9/21/2018
2.1.0-rc1 1,698 9/14/2018
2.1.0-beta1 1,725 8/27/2018
2.0.4 2,163 7/20/2018
2.0.0 2,402 3/28/2018
2.0.0-rc2 1,652 3/13/2018
2.0.0-rc1 1,801 2/26/2018
2.0.0-beta3 1,972 12/21/2017
2.0.0-beta2 1,942 12/11/2017