Microsoft.Orleans.Persistence.AdoNet
9.2.1
Prefix Reserved
dotnet add package Microsoft.Orleans.Persistence.AdoNet --version 9.2.1
NuGet\Install-Package Microsoft.Orleans.Persistence.AdoNet -Version 9.2.1
<PackageReference Include="Microsoft.Orleans.Persistence.AdoNet" Version="9.2.1" />
<PackageVersion Include="Microsoft.Orleans.Persistence.AdoNet" Version="9.2.1" />
<PackageReference Include="Microsoft.Orleans.Persistence.AdoNet" />
paket add Microsoft.Orleans.Persistence.AdoNet --version 9.2.1
#r "nuget: Microsoft.Orleans.Persistence.AdoNet, 9.2.1"
#:package Microsoft.Orleans.Persistence.AdoNet@9.2.1
#addin nuget:?package=Microsoft.Orleans.Persistence.AdoNet&version=9.2.1
#tool nuget:?package=Microsoft.Orleans.Persistence.AdoNet&version=9.2.1
Microsoft Orleans Persistence for ADO.NET
Introduction
Microsoft Orleans Persistence for ADO.NET provides grain persistence for Microsoft Orleans using relational databases through ADO.NET. This provider allows your grains to persist their state in various relational databases including SQL Server, MySQL, PostgreSQL, and Oracle.
Getting Started
To use this package, install it via NuGet:
dotnet add package Microsoft.Orleans.Persistence.AdoNet
You will also need to install the appropriate database driver package for your database system:
- SQL Server:
Microsoft.Data.SqlClient
orSystem.Data.SqlClient
- MySQL:
MySql.Data
orMySqlConnector
- PostgreSQL:
Npgsql
- Oracle:
Oracle.ManagedDataAccess.Core
- SQLite:
Microsoft.Data.Sqlite
Example - Configuring ADO.NET Persistence
using Microsoft.Extensions.Hosting;
using Orleans.Configuration;
using Orleans.Hosting;
var builder = Host.CreateApplicationBuilder(args)
.UseOrleans(siloBuilder =>
{
siloBuilder
.UseLocalhostClustering()
// Configure ADO.NET as grain storage
.AddAdoNetGrainStorage(
name: "AdoNetStore",
configureOptions: options =>
{
options.Invariant = "System.Data.SqlClient"; // Or other providers like "MySql.Data.MySqlClient", "Npgsql", etc.
options.ConnectionString = "Server=localhost;Database=OrleansStorage;User Id=myUsername;******;";
// Optional: Configure custom queries
options.UseJsonFormat = true; // Store as JSON instead of binary
});
});
// Run the host
await builder.RunAsync();
Example - Using Grain Storage in a Grain
using System;
using System.Threading.Tasks;
using Orleans;
using Orleans.Runtime;
// Define grain state class
public class MyGrainState
{
public string Data { get; set; }
public int Version { get; set; }
}
// Grain implementation that uses the ADO.NET storage
public class MyGrain : Grain, IMyGrain, IGrainWithStringKey
{
private readonly IPersistentState<MyGrainState> _state;
public MyGrain([PersistentState("state", "AdoNetStore")] 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);
}
}
Database Setup
Before using the ADO.NET provider, you need to set up the necessary database tables. Scripts for different database systems are available in the Orleans source repository:
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 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. |
-
net8.0
- Microsoft.AspNetCore.Connections.Abstractions (>= 8.0.11)
- Microsoft.CodeAnalysis.Analyzers (>= 3.11.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.11)
- Microsoft.Extensions.Options (>= 8.0.2)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 8.0.0)
- Microsoft.Orleans.Analyzers (>= 9.2.1)
- Microsoft.Orleans.CodeGenerator (>= 9.2.1)
- Microsoft.Orleans.Reminders (>= 9.2.1)
- Microsoft.Orleans.Runtime (>= 9.2.1)
- Newtonsoft.Json (>= 13.0.3)
- System.Collections.Immutable (>= 8.0.0)
- System.IO.Hashing (>= 8.0.0)
- System.IO.Pipelines (>= 8.0.0)
- System.Memory.Data (>= 8.0.1)
NuGet packages (12)
Showing the top 5 NuGet packages that depend on Microsoft.Orleans.Persistence.AdoNet:
Package | Downloads |
---|---|
Microsoft.Orleans.OrleansSqlUtils
Library of utility types for relational storage of Microsoft Orleans |
|
KingMetal.Domains.Abstractions
Package Description |
|
Mtl.Infrastructures.Workers
主要是封装了下Netty服务器和客户端的方法,提供了简单的方法调用就能启动Netty服务器和客户端,封装了Orleans的服务器和客户端的启动和连接方法,使操作简单,减少重复的代码 |
|
ZLSoft.QWPlatform.WebBasics
基础服务 |
|
Orleans.AdoNet.Extensions
Orleans extensions for configuring cluster,reminder,grain persistence and so on |
GitHub repositories (3)
Showing the top 3 popular GitHub repositories that depend on Microsoft.Orleans.Persistence.AdoNet:
Repository | Stars |
---|---|
axzxs2001/Asp.NetCoreExperiment
原来所有项目都移动到**OleVersion**目录下进行保留。新的案例装以.net 5.0为主,一部分对以前案例进行升级,一部分将以前的工作经验总结出来,以供大家参考!
|
|
OrleansContrib/Orleans.Sagas
A distributed saga implementation for Orleans
|
|
shinyorg/templates
dotnet CLI & Visual Studio Templates
|
Version | Downloads | Last Updated |
---|---|---|
9.2.1 | 358 | 7/16/2025 |
9.2.0 | 514 | 7/14/2025 |
9.2.0-preview3 | 412 | 6/10/2025 |
9.2.0-preview2 | 198 | 6/4/2025 |
9.2.0-preview1 | 301 | 4/4/2025 |
9.1.2 | 37,920 | 2/13/2025 |
9.0.1 | 22,641 | 11/23/2024 |
9.0.0 | 2,582 | 11/14/2024 |
8.2.0 | 85,219 | 7/12/2024 |
8.2.0-preview1 | 341 | 5/22/2024 |
8.1.0 | 51,171 | 4/17/2024 |
8.1.0-preview3 | 245 | 3/11/2024 |
8.1.0-preview2 | 369 | 2/23/2024 |
8.1.0-preview1 | 174 | 2/13/2024 |
8.0.0 | 51,542 | 1/5/2024 |
8.0.0-rc2 | 276 | 12/20/2023 |
8.0.0-rc1 | 343 | 12/4/2023 |
7.2.7 | 2,745 | 10/15/2024 |
7.2.6 | 16,295 | 3/9/2024 |
7.2.5 | 553 | 2/22/2024 |
7.2.4 | 13,871 | 12/2/2023 |
7.2.3 | 19,710 | 11/3/2023 |
7.2.2 | 7,115 | 10/16/2023 |
7.2.1 | 172,397 | 7/11/2023 |
7.2.0 | 639 | 7/7/2023 |
7.1.2 | 58,813 | 4/19/2023 |
7.1.1 | 8,151 | 3/23/2023 |
7.1.0 | 12,041 | 2/1/2023 |
7.0.0 | 20,839 | 11/8/2022 |
7.0.0-rc2 | 593 | 10/19/2022 |
4.0.0-preview2 | 2,445 | 8/4/2022 |
4.0.0-preview1 | 3,010 | 2/10/2022 |
3.8.0 | 385 | 5/6/2025 |
3.8.0-preview5 | 234 | 5/12/2025 |
3.8.0-preview3 | 219 | 4/8/2025 |
3.8.0-preview2 | 126 | 4/4/2025 |
3.8.0-preview1 | 182 | 3/31/2025 |
3.7.2 | 42,279 | 5/10/2024 |
3.7.1 | 43,798 | 5/27/2023 |
3.7.0 | 8,369 | 3/23/2023 |
3.6.5 | 180,697 | 8/15/2022 |
3.6.4 | 14,146 | 8/10/2022 |
3.6.3 | 7,081 | 8/4/2022 |
3.6.2 | 75,633 | 4/15/2022 |
3.6.1 | 29,953 | 4/5/2022 |
3.6.0 | 82,237 | 1/20/2022 |
3.5.1 | 155,389 | 11/8/2021 |
3.5.0 | 157,626 | 9/3/2021 |
3.4.4 | 1,672 | 10/4/2021 |
3.4.3 | 66,820 | 6/3/2021 |
3.4.2 | 47,637 | 4/5/2021 |
3.4.1 | 186,630 | 2/3/2021 |
3.4.0 | 19,954 | 1/6/2021 |
3.4.0-rc1 | 548 | 12/9/2020 |
3.3.0 | 65,560 | 9/9/2020 |
3.3.0-rc2 | 507 | 9/2/2020 |
3.3.0-rc1 | 514 | 8/19/2020 |
3.2.2 | 17,544 | 7/22/2020 |
3.2.1 | 6,571 | 7/2/2020 |
3.2.0 | 16,095 | 6/4/2020 |
3.2.0-rc2 | 636 | 5/20/2020 |
3.2.0-rc1 | 517 | 5/7/2020 |
3.1.7 | 7,140 | 5/19/2020 |
3.1.6 | 47,539 | 4/16/2020 |
3.1.5 | 2,745 | 4/9/2020 |
3.1.4 | 3,245 | 3/26/2020 |
3.1.3 | 6,893 | 3/16/2020 |
3.1.2 | 13,310 | 3/5/2020 |
3.1.0 | 3,600 | 2/23/2020 |
3.1.0-rc3 | 660 | 2/13/2020 |
3.1.0-rc2 | 602 | 2/12/2020 |
3.1.0-rc1 | 655 | 2/10/2020 |
3.0.2 | 61,293 | 12/12/2019 |
3.0.1 | 17,107 | 11/27/2019 |
3.0.0 | 37,651 | 10/24/2019 |
3.0.0-rc2 | 681 | 10/16/2019 |
3.0.0-rc1 | 565 | 10/9/2019 |
3.0.0-beta1 | 43,051 | 8/16/2019 |
2.4.5 | 114,482 | 12/29/2019 |
2.4.4 | 43,978 | 11/27/2019 |
2.4.3 | 54,388 | 10/10/2019 |
2.4.2 | 23,566 | 8/31/2019 |
2.4.1 | 12,559 | 8/14/2019 |
2.4.0 | 3,093 | 8/8/2019 |
2.3.6 | 11,404 | 7/24/2019 |
2.3.5 | 21,314 | 6/14/2019 |
2.3.4 | 16,466 | 6/4/2019 |
2.3.3 | 3,197 | 6/2/2019 |
2.3.2 | 16,802 | 5/9/2019 |
2.3.1 | 12,706 | 4/26/2019 |
2.3.0 | 49,192 | 3/20/2019 |
2.3.0-rc2 | 3,500 | 3/13/2019 |
2.3.0-rc1 | 2,579 | 3/4/2019 |
2.2.4 | 4,854 | 2/25/2019 |
2.2.3 | 10,068 | 1/17/2019 |
2.2.0 | 11,869 | 12/13/2018 |
2.2.0-rc1 | 2,659 | 12/4/2018 |
2.2.0-beta1 | 3,246 | 10/21/2018 |
2.1.2 | 13,347 | 10/11/2018 |
2.1.0 | 7,860 | 9/28/2018 |
2.1.0-rc2 | 3,164 | 9/21/2018 |
2.1.0-rc1 | 3,317 | 9/14/2018 |
2.1.0-beta1 | 3,217 | 8/27/2018 |
2.0.0 | 15,857 | 3/28/2018 |
2.0.0-rc2 | 3,317 | 3/13/2018 |
2.0.0-rc1 | 3,403 | 2/26/2018 |
2.0.0-beta3 | 3,950 | 12/21/2017 |