![]() |
VOOZH | about |
dotnet add package Microsoft.Orleans.Persistence.AzureStorage --version 10.2.0
NuGet\Install-Package Microsoft.Orleans.Persistence.AzureStorage -Version 10.2.0
<PackageReference Include="Microsoft.Orleans.Persistence.AzureStorage" Version="10.2.0" />
<PackageVersion Include="Microsoft.Orleans.Persistence.AzureStorage" Version="10.2.0" />Directory.Packages.props
<PackageReference Include="Microsoft.Orleans.Persistence.AzureStorage" />Project file
paket add Microsoft.Orleans.Persistence.AzureStorage --version 10.2.0
#r "nuget: Microsoft.Orleans.Persistence.AzureStorage, 10.2.0"
#:package Microsoft.Orleans.Persistence.AzureStorage@10.2.0
#addin nuget:?package=Microsoft.Orleans.Persistence.AzureStorage&version=10.2.0Install as a Cake Addin
#tool nuget:?package=Microsoft.Orleans.Persistence.AzureStorage&version=10.2.0Install as a Cake Tool
Microsoft Orleans Persistence for Azure Storage provides grain persistence for Microsoft Orleans using Azure Storage (Blob and Table). This allows your grains to persist their state in Azure Storage and reload it when they are reactivated.
To use this package, install it via NuGet:
dotnet add package Microsoft.Orleans.Persistence.AzureStorage
using Microsoft.Extensions.Hosting;
using Orleans.Configuration;
using Orleans.Hosting;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Threading.Tasks;
// Define grain interface
public interface IMyGrain : IGrainWithStringKey
{
Task SetData(string data);
Task<string> GetData();
}
var builder = Host.CreateApplicationBuilder(args)
.UseOrleans(siloBuilder =>
{
siloBuilder
.UseLocalhostClustering()
// Configure Azure Table Storage as grain storage
.AddAzureTableGrainStorage(
name: "tableStore",
configureOptions: options =>
{
options.ConnectionString = "YOUR_AZURE_STORAGE_CONNECTION_STRING";
})
// Configure Azure Blob Storage as grain storage
.AddAzureBlobGrainStorage(
name: "blobStore",
configureOptions: options =>
{
options.ConnectionString = "YOUR_AZURE_STORAGE_CONNECTION_STRING";
});
});
var host = builder.Build();
await host.StartAsync();
// Get a reference to a grain and call it
var client = host.Services.GetRequiredService<IClusterClient>();
var grain = client.GetGrain<IMyGrain>("user123");
await grain.SetData("Hello from Azure Storage!");
var response = await grain.GetData();
// Print the result
Console.WriteLine($"Grain data: {response}");
// Keep the host running until the application is shut down
await host.WaitForShutdownAsync();
using System;
using System.Threading.Tasks;
using Orleans;
using Orleans.Runtime;
namespace ExampleGrains;
// Define grain state class
public class MyGrainState
{
public string Data { get; set; }
public int Version { get; set; }
}
// Grain implementation that uses the Azure storage
public class MyGrain : Grain, IMyGrain, IGrainWithStringKey
{
private readonly IPersistentState<MyGrainState> _state;
public MyGrain([PersistentState("state", "tableStore")] IPersistentState<MyGrainState> state)
{
_state = state;
}
public async Task SetData(string data)
{
_state.State.Data = data;
_state.State.Version++;
await _state.WriteStateAsync();
}
public Task<string> GetData()
{
return Task.FromResult(_state.State.Data);
}
}
For more comprehensive documentation, please refer to:
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 is compatible. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
Showing the top 5 NuGet packages that depend on Microsoft.Orleans.Persistence.AzureStorage:
| Package | Downloads |
|---|---|
|
Blauhaus.Orleans
Package Description |
|
|
Blauhaus.EVACS.Orleans
Package Description |
|
|
Microsoft.Orleans.OrleansAzureUtils
Support library for hosting Orleans on Microsoft Azure. |
|
|
Orleans.Contrib.UniversalSilo
This library provides primitives to set up a configurable, application-agnostic Orleans silo and clients. Use it with the Orleans.Contrib.UniversalSilo.Templates to get started with Orleans. |
|
|
Nabs.Launchpad.Core.Silo
Package Description |
Showing the top 7 popular GitHub repositories that depend on Microsoft.Orleans.Persistence.AzureStorage:
| Repository | Stars |
|---|---|
|
microsoft/aspire
Aspire is the tool for code-first, extensible, observable dev and deploy.
|
|
|
dotnet/samples
Sample code referenced by the .NET documentation
|
|
|
Dotnet-Boxed/Templates
.NET project templates with batteries included, providing the minimum amount of code required to get you going faster.
|
|
|
microsoft/dotnet-podcasts
.NET reference application shown at .NET Conf featuring ASP.NET Core, Blazor, .NET MAUI, Microservices, Orleans, Playwright, and more!
|
|
|
J-Tech-Japan/Sekiban
Sekiban - an Opinionated Event Sourcing and CQRS Framework using C#. It can store data into Azure Cosmos DB, AWS Dynamo DB or Postgres
|
|
|
Samsung/Tizen.NET
Welcome to Tizen .NET
|
|
|
ReubenBond/hanbaobao-web
Orleans sample application with Kubernetes hosting
|
| Version | Downloads | Last Updated |
|---|---|---|
| 10.2.0 | 907 | 6/12/2026 |
| 10.1.1-preview.1 | 71 | 5/13/2026 |
| 10.1.0 | 39,092 | 4/14/2026 |
| 10.0.1 | 132,046 | 2/7/2026 |
| 10.0.0 | 23,289 | 1/20/2026 |
| 10.0.0-rc.2 | 778 | 12/31/2025 |
| 9.2.1 | 228,805 | 7/16/2025 |
| 9.2.0 | 2,295 | 7/14/2025 |
| 9.2.0-preview3 | 791 | 6/10/2025 |
| 9.2.0-preview2 | 291 | 6/4/2025 |
| 9.2.0-preview1 | 6,037 | 4/4/2025 |
| 9.1.2 | 167,315 | 2/13/2025 |
| 3.8.1 | 267 | 4/24/2026 |
| 3.8.0 | 5,670 | 5/6/2025 |
| 3.8.0-preview5 | 406 | 5/12/2025 |
| 3.8.0-preview3 | 366 | 4/8/2025 |
| 3.8.0-preview2 | 319 | 4/4/2025 |
| 3.8.0-preview1 | 351 | 3/31/2025 |