Microsoft.Orleans.Clustering.AdoNet
10.4.0
Prefix Reserved
dotnet add package Microsoft.Orleans.Clustering.AdoNet --version 10.4.0
NuGet\Install-Package Microsoft.Orleans.Clustering.AdoNet -Version 10.4.0
<PackageReference Include="Microsoft.Orleans.Clustering.AdoNet" Version="10.4.0" />
<PackageVersion Include="Microsoft.Orleans.Clustering.AdoNet" Version="10.4.0" />
<PackageReference Include="Microsoft.Orleans.Clustering.AdoNet" />
paket add Microsoft.Orleans.Clustering.AdoNet --version 10.4.0
#r "nuget: Microsoft.Orleans.Clustering.AdoNet, 10.4.0"
#:package Microsoft.Orleans.Clustering.AdoNet@10.4.0
#addin nuget:?package=Microsoft.Orleans.Clustering.AdoNet&version=10.4.0
#tool nuget:?package=Microsoft.Orleans.Clustering.AdoNet&version=10.4.0
Microsoft Orleans Clustering Provider for ADO.NET
Introduction
Microsoft Orleans Clustering Provider for ADO.NET allows Orleans silos to organize themselves as a cluster using relational databases through ADO.NET. This provider enables silos to discover each other, maintain cluster membership, and detect and handle failures.
Getting Started
To use this package, install it via NuGet:
dotnet add package Microsoft.Orleans.Clustering.AdoNet
You will also need to install the appropriate database driver package for your database system:
- SQL Server:
Microsoft.Data.SqlClient - MySQL:
MySql.DataorMySqlConnector - PostgreSQL:
Npgsql - Oracle:
Oracle.ManagedDataAccess.Core - SQLite:
Microsoft.Data.Sqlite
Example - Configuring ADO.NET Clustering
using Microsoft.Extensions.Hosting;
using Orleans.Configuration;
using Orleans.Hosting;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Threading.Tasks;
// Define a grain interface
public interface IHelloGrain : IGrainWithStringKey
{
Task<string> SayHello(string greeting);
}
// Implement the grain interface
public class HelloGrain : Grain, IHelloGrain
{
public Task<string> SayHello(string greeting)
{
return Task.FromResult($"Hello, {greeting}!");
}
}
var builder = Host.CreateApplicationBuilder(args)
.UseOrleans(siloBuilder =>
{
siloBuilder
// Configure ADO.NET for clustering
.UseAdoNetClustering(options =>
{
options.Invariant = "System.Data.SqlClient"; // Or other providers like "MySql.Data.MySqlClient", "Npgsql", etc.
options.ConnectionString = "Server=localhost;Database=OrleansCluster;User Id=myUsername;******;";
});
});
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<IHelloGrain>("user123");
var response = await grain.SayHello("World");
// Print the result
Console.WriteLine($"Grain response: {response}");
// Keep the host running until the application is shut down
await host.WaitForShutdownAsync();
Example - Configuring Client to Connect to Cluster
using Microsoft.Extensions.Hosting;
using Orleans;
using Orleans.Configuration;
using Microsoft.Extensions.DependencyInjection;
using System;
using System.Threading.Tasks;
// Define a grain interface
public interface IHelloGrain : IGrainWithStringKey
{
Task<string> SayHello(string greeting);
}
var clientBuilder = Host.CreateApplicationBuilder(args)
.UseOrleansClient(clientBuilder =>
{
clientBuilder
// Configure the client to use ADO.NET for clustering
.UseAdoNetClustering(options =>
{
options.Invariant = "Microsoft.Data.SqlClient"; // Or other providers like "MySql.Data.MySqlClient", "Npgsql", etc.
options.ConnectionString = "Server=localhost;Database=OrleansCluster;User Id=myUsername;******;";
});
});
var host = clientBuilder.Build();
await host.StartAsync();
var client = host.Services.GetRequiredService<IClusterClient>();
// Get a reference to a grain and call it
var grain = client.GetGrain<IHelloGrain>("user123");
var response = await grain.SayHello("World");
// Print the result
Console.WriteLine($"Grain response: {response}");
// Keep the host running until the application is shut down
await host.WaitForShutdownAsync();
Database Setup
Before using the ADO.NET clustering provider, you need to set up the necessary database tables. Scripts for different database systems are available in the Orleans source repository: namespace ExampleGrains;
Optional membership SQL enhancements
Each silo owns its heartbeat. A heartbeat is one primary-key-targeted assignment to IAmAliveTime, sent as a single database command. Heartbeats preserve the logical membership row and table tokens, so a membership update can use tokens captured before a heartbeat. Canonical membership consistency is governed by those logical tokens; heartbeat timestamps are best-effort liveness observations.
Upgrading silos or ADO.NET gateway-discovery clients preserves support for existing query installations. Database updates are optional. With an existing catalog, cleanup continues using its installed CleanupDefunctSiloEntriesKey query and behavior.
The existing *-Clustering.sql installation scripts include improved conditional-write rollback and Dead-row cleanup. Their optional CleanupDefunctSiloEntryKey enables cleanup based on the latest start, heartbeat, and suspicion timestamps, with a captured-row condition protecting concurrent changes. Fresh installations receive these definitions through the usual database setup.
SQL Server joined membership reads use statement snapshots provided by READ_COMMITTED_SNAPSHOT, which the existing SQLServer-Main.sql setup enables.
Providers load and cache queries during initialization. Existing deployments continue using their installed definitions. Operators choosing to adopt revised definitions can use their normal database change-management process; reinitialize providers afterward to load the revised catalog. The original query keys and parameter sets remain supported.
The SQL enhancements take effect per process as it adopts the updated queries. Until then, cached SQL Server/MySQL updates retain their previous missing-row version-increment behavior, and cached cleanup retains its previous status filter. The enhanced behavior applies cluster-wide once all membership writers use those definitions. SQL Server and MySQL inserts retain the original row-then-version statement order.
Documentation
For more comprehensive documentation, please refer to:
Feedback & Contributing
- If you have any issues or would like to provide feedback, please open an issue on GitHub
- Join our community on Discord
- Follow the @msftorleans Twitter account for Orleans announcements
- Contributions are welcome! Please review our contribution guidelines
- This project is licensed under the MIT license
| Product | Versions 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 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. |
-
net10.0
- Microsoft.AspNetCore.Connections.Abstractions (>= 10.0.3)
- Microsoft.CodeAnalysis.Analyzers (>= 5.9.0)
- Microsoft.CodeAnalysis.Common (>= 5.0.0)
- Microsoft.CodeAnalysis.Workspaces.Common (>= 5.0.0)
- Microsoft.Extensions.Configuration (>= 10.0.5)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.5)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.5)
- Microsoft.Extensions.Configuration.Json (>= 10.0.5)
- Microsoft.Extensions.DependencyInjection (>= 10.0.5)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.5)
- Microsoft.Extensions.DependencyModel (>= 10.0.5)
- Microsoft.Extensions.Hosting (>= 10.0.5)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.5)
- Microsoft.Extensions.Logging (>= 10.0.5)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.5)
- Microsoft.Extensions.Logging.Console (>= 10.0.5)
- Microsoft.Extensions.Logging.Debug (>= 10.0.5)
- Microsoft.Extensions.ObjectPool (>= 10.0.5)
- Microsoft.Extensions.Options (>= 10.0.5)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 10.0.5)
- Microsoft.Orleans.Runtime (>= 10.4.0)
- Newtonsoft.Json (>= 13.0.4)
- Polly (>= 8.6.4)
- Polly.Extensions (>= 8.6.5)
- System.IO.Hashing (>= 10.0.3)
- System.Memory.Data (>= 10.0.3)
-
net8.0
- Microsoft.AspNetCore.Connections.Abstractions (>= 8.0.24)
- Microsoft.CodeAnalysis.Analyzers (>= 5.9.0)
- Microsoft.CodeAnalysis.Common (>= 4.5.0)
- Microsoft.CodeAnalysis.Workspaces.Common (>= 4.5.0)
- Microsoft.Extensions.Configuration (>= 8.0.0)
- Microsoft.Extensions.Configuration.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Configuration.Binder (>= 8.0.2)
- Microsoft.Extensions.Configuration.Json (>= 8.0.1)
- Microsoft.Extensions.DependencyInjection (>= 8.0.1)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- Microsoft.Extensions.DependencyModel (>= 8.0.2)
- Microsoft.Extensions.Hosting (>= 8.0.1)
- Microsoft.Extensions.Hosting.Abstractions (>= 8.0.1)
- Microsoft.Extensions.Logging (>= 8.0.1)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.3)
- Microsoft.Extensions.Logging.Console (>= 8.0.1)
- Microsoft.Extensions.Logging.Debug (>= 8.0.1)
- Microsoft.Extensions.ObjectPool (>= 8.0.24)
- Microsoft.Extensions.Options (>= 8.0.2)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 8.0.0)
- Microsoft.Orleans.Runtime (>= 10.4.0)
- Newtonsoft.Json (>= 13.0.4)
- Polly (>= 8.6.4)
- Polly.Extensions (>= 8.6.5)
- System.IO.Hashing (>= 10.0.3)
- System.IO.Pipelines (>= 8.0.0)
- System.Memory.Data (>= 8.0.1)
NuGet packages (34)
Showing the top 5 NuGet packages that depend on Microsoft.Orleans.Clustering.AdoNet:
| Package | Downloads |
|---|---|
|
Microsoft.Orleans.OrleansSqlUtils
Library of utility types for relational storage of Microsoft Orleans |
|
|
Aksio.Cratis.Extensions.Orleans
Package Description |
|
|
KingMetal.Domains.Abstractions
Package Description |
|
|
Mtl.Infrastructures.Workers
主要是封装了下Netty服务器和客户端的方法,提供了简单的方法调用就能启动Netty服务器和客户端,封装了Orleans的服务器和客户端的启动和连接方法,使操作简单,减少重复的代码 |
|
|
Aksio.Cratis.Kernel.Orleans
Package Description |
GitHub repositories (3)
Showing the top 3 popular GitHub repositories that depend on Microsoft.Orleans.Clustering.AdoNet:
| Repository | Stars |
|---|---|
|
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
|
|
|
shinyorg/templates
dotnet CLI & Visual Studio Templates
|
|
|
usnistgov/ACVP-Server
A repository tracking releases of NIST's ACVP server. See www.github.com/usnistgov/ACVP for the protocol.
|
| Version | Downloads | Last Updated |
|---|---|---|
| 10.4.0 | 22,752 | 10/3/2026 |
| 10.3.1 | 45,504 | 8/28/2026 |
| 10.3.0 | 2,226 | 8/27/2026 |
| 10.3.0-rc.1 | 109 | 8/25/2026 |
| 10.2.2 | 64,172 | 7/21/2026 |
| 10.2.2-rc.2 | 156 | 7/15/2026 |
| 10.2.2-rc.1 | 151 | 7/10/2026 |
| 10.2.1 | 32,302 | 6/24/2026 |
| 10.2.1-preview.1 | 145 | 6/19/2026 |
| 10.2.0 | 15,394 | 6/12/2026 |
| 10.1.1-preview.1 | 139 | 5/13/2026 |
| 10.1.0 | 168,372 | 4/14/2026 |
| 10.0.1 | 91,202 | 2/7/2026 |
| 10.0.0 | 32,111 | 1/20/2026 |
| 10.0.0-rc.2 | 730 | 12/31/2025 |
| 9.2.1 | 204,475 | 7/16/2025 |
| 9.2.0 | 2,404 | 7/14/2025 |
| 9.2.0-preview3 | 663 | 6/10/2025 |
| 9.2.0-preview2 | 337 | 6/4/2025 |
| 3.8.1 | 38,167 | 4/24/2026 |