Skip to content

Commit fb6e706

Browse files
authored
Update to .Net10 - Orleans 10 (#165)
* Updated net version * Updated test deps * Fixed braking change * Updated orleans to version 10 * Centralized package management * Updated net version used in actions * Update docs
1 parent ad56e34 commit fb6e706

File tree

11 files changed

+54
-41
lines changed

11 files changed

+54
-41
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- name: Setup .NET Core
1616
uses: actions/setup-dotnet@v3
1717
with:
18-
dotnet-version: 7.x
18+
dotnet-version: 10.x
1919
- name: Build
2020
run: dotnet build --configuration Release
2121
- name: Test

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- name: Setup .NET Core
1919
uses: actions/setup-dotnet@v3
2020
with:
21-
dotnet-version: 7.x
21+
dotnet-version: 10.x
2222
- name: Build
2323
run: dotnet build --configuration Release
2424
- name: Test

Directory.Build.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@
1919

2020
<!-- Common compile parameters -->
2121
<PropertyGroup>
22-
<TargetFramework>net7.0</TargetFramework>
22+
<TargetFramework>net10.0</TargetFramework>
2323
<ImplicitUsings>enable</ImplicitUsings>
2424
<LangVersion>latest</LangVersion>
2525
<Nullable>enable</Nullable>
2626
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
27-
<NoWarn>$(NoWarn);1701;1702;1705;1591</NoWarn>
27+
<NoWarn>$(NoWarn);1701;1702;1705;1591;NU1507</NoWarn>
2828
</PropertyGroup>
2929

3030
<ItemGroup>

Directory.Packages.props

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<Project>
2+
<PropertyGroup>
3+
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
4+
<CentralPackageTransitivePinningEnabled>true</CentralPackageTransitivePinningEnabled>
5+
</PropertyGroup>
6+
<ItemGroup>
7+
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
8+
<PackageVersion Include="Microsoft.Orleans.Server" Version="10.0.0" />
9+
<PackageVersion Include="Microsoft.Orleans.Streaming" Version="10.0.0" />
10+
11+
<PackageVersion Include="coverlet.collector" Version="6.0.4" />
12+
<PackageVersion Include="xunit" Version="2.9.3" />
13+
<PackageVersion Include="xunit.runner.visualstudio" Version="3.1.5" />
14+
</ItemGroup>
15+
</Project>

README.Nuget.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66

77
[Orleans](https://learn.microsoft.com/en-us/dotnet/orleans/overview) is a cross-platform framework for building robust, scalable distributed applications. Distributed applications are defined as apps that span more than a single process, often beyond hardware boundaries using peer-to-peer communication. Orleans scales from a single on-premises server to hundreds to thousands of distributed, highly available applications in the cloud. [See Orleans source code on Github](https://github.com/dotnet/orleans)
88

9-
[ASP.NET Core SignalR](https://learn.microsoft.com/en-us/aspnet/core/signalr/introduction?view=aspnetcore-7.0) is an open-source library that simplifies adding real-time web functionality to apps. Real-time web functionality enables server-side code to push content to clients instantly.
9+
[ASP.NET Core SignalR](https://learn.microsoft.com/en-us/aspnet/core/signalr/introduction?view=aspnetcore-10.0) is an open-source library that simplifies adding real-time web functionality to apps. Real-time web functionality enables server-side code to push content to clients instantly.
1010

1111
**SignalR.Orleans** is a package that gives you two abilities:
1212

13-
1. Use your Orleans cluster as a backplane for SignalR. [Learn about scaling out SignalR on multiple servers.](https://learn.microsoft.com/en-us/aspnet/core/signalr/scale?view=aspnetcore-7.0)
13+
1. Use your Orleans cluster as a backplane for SignalR. [Learn about scaling out SignalR on multiple servers.](https://learn.microsoft.com/en-us/aspnet/core/signalr/scale?view=aspnetcore-10.0)
1414

1515
> There are various choices of backplane that you can use for SignalR, as you will see in the link above. If you're already using Orleans, then you might want to use Orleans as the backplane to reduce the number of dependencies used by your application and to reduce the number of network hops (and latency) that would be required when calling an external service.
1616
@@ -26,7 +26,7 @@ TODO: These two abilities should be provided independently of each other. Unfort
2626

2727
Installation is performed via [NuGet.](https://www.nuget.org/packages/SignalR.Orleans/)
2828

29-
Packages with version `7.x.x` are compatible with Orleans `v7.x.x` and above. If you're still using an earlier version of Orleans, you will need to use earlier versions of the package.
29+
Packages with version `10.x.x` are compatible with Orleans `v10.x.x` and above. If you're still using an earlier version of Orleans, you will need to use earlier versions of the package.
3030

3131
Package Manager:
3232

@@ -41,7 +41,7 @@ Paket:
4141
> \# paket add SignalR.Orleans
4242
4343
---
44-
# Version 7.0.0 documentation
44+
# Version 10.0.0 documentation
4545
> Scroll down to see documentation for earlier versions.
4646
4747
Here is a complete starter example featuring cohosted aspnetcore app with SignalR and Orleans.
@@ -68,7 +68,7 @@ var app = builder.Build();
6868
app.MapHub<MyHub>("/myhub");
6969
await app.RunAsync();
7070

71-
// A SignalR Hub. https://learn.microsoft.com/en-us/aspnet/core/signalr/hubs?view=aspnetcore-7.0
71+
// A SignalR Hub. https://learn.microsoft.com/en-us/aspnet/core/signalr/hubs?view=aspnetcore-10.0
7272
class MyHub : Hub
7373
{
7474
}
@@ -111,7 +111,7 @@ siloBuilder.UseSignalR();
111111

112112
## Sending messages from Orleans grains
113113

114-
If the SignalR app is cohosted as demonstrated above, you don't need this package to send messages from an Orleans grain. Simply inject `IHubContext<MyHub>` to the grain's constructor and call its methods to send messages. [Read more about it here.](https://learn.microsoft.com/en-us/aspnet/core/signalr/hubcontext?view=aspnetcore-7.0)
114+
If the SignalR app is cohosted as demonstrated above, you don't need this package to send messages from an Orleans grain. Simply inject `IHubContext<MyHub>` to the grain's constructor and call its methods to send messages. [Read more about it here.](https://learn.microsoft.com/en-us/aspnet/core/signalr/hubcontext?view=aspnetcore-10.0)
115115

116116
However, if the SignalR app is not cohosted, and if it's using Orleans as a backplane, then it's possible to use this package to send messages to the SignalR clients using the backplane streams in Orleans as a conduit (ability #2).
117117

@@ -172,13 +172,13 @@ var app = builder.Build();
172172
app.MapHub<MyHub>("/myhub");
173173
await app.RunAsync();
174174

175-
// A SignalR Hub. https://learn.microsoft.com/en-us/aspnet/core/signalr/hubs?view=aspnetcore-7.0
175+
// A SignalR Hub. https://learn.microsoft.com/en-us/aspnet/core/signalr/hubs?view=aspnetcore-10.0
176176
class MyHub : Hub
177177
{
178178
}
179179
```
180180

181-
This is the end of documentation for versions >= 7.0.0. Below is older documenation for previous versions.
181+
This is the end of documentation for versions >= 10.0.0. Below is older documenation for previous versions.
182182

183183
---
184184
# Earlier version documentation

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111

1212
[Orleans](https://learn.microsoft.com/en-us/dotnet/orleans/overview) is a cross-platform framework for building robust, scalable distributed applications. Distributed applications are defined as apps that span more than a single process, often beyond hardware boundaries using peer-to-peer communication. Orleans scales from a single on-premises server to hundreds to thousands of distributed, highly available applications in the cloud. [See Orleans source code on Github](https://github.com/dotnet/orleans)
1313

14-
[ASP.NET Core SignalR](https://learn.microsoft.com/en-us/aspnet/core/signalr/introduction?view=aspnetcore-7.0) is an open-source library that simplifies adding real-time web functionality to apps. Real-time web functionality enables server-side code to push content to clients instantly.
14+
[ASP.NET Core SignalR](https://learn.microsoft.com/en-us/aspnet/core/signalr/introduction?view=aspnetcore-10.0) is an open-source library that simplifies adding real-time web functionality to apps. Real-time web functionality enables server-side code to push content to clients instantly.
1515

1616
**SignalR.Orleans** is a package that gives you two abilities:
1717

18-
1. Use your Orleans cluster as a backplane for SignalR. [Learn about scaling out SignalR on multiple servers.](https://learn.microsoft.com/en-us/aspnet/core/signalr/scale?view=aspnetcore-7.0)
18+
1. Use your Orleans cluster as a backplane for SignalR. [Learn about scaling out SignalR on multiple servers.](https://learn.microsoft.com/en-us/aspnet/core/signalr/scale?view=aspnetcore-10.0)
1919

2020
> There are various choices of backplane that you can use for SignalR, as you will see in the link above. If you're already using Orleans, then you might want to use Orleans as the backplane to reduce the number of dependencies used by your application and to reduce the number of network hops (and latency) that would be required when calling an external service.
2121
@@ -31,7 +31,7 @@ TODO: These two abilities should be provided independently of each other. Unfort
3131

3232
Installation is performed via [NuGet.](https://www.nuget.org/packages/SignalR.Orleans/)
3333

34-
Packages with version `7.x.x` are compatible with Orleans `v7.x.x` and above. If you're still using an earlier version of Orleans, you will need to use earlier versions of the package.
34+
Packages with version `10.x.x` are compatible with Orleans `v10.x.x` and above. If you're still using an earlier version of Orleans, you will need to use earlier versions of the package.
3535

3636
Package Manager:
3737

@@ -46,7 +46,7 @@ Paket:
4646
> \# paket add SignalR.Orleans
4747
4848
---
49-
# Version 7.0.0 documentation
49+
# Version 10.0.0 documentation
5050
> Scroll down to see documentation for earlier versions.
5151
5252
Here is a complete starter example featuring cohosted aspnetcore app with SignalR and Orleans.
@@ -73,7 +73,7 @@ var app = builder.Build();
7373
app.MapHub<MyHub>("/myhub");
7474
await app.RunAsync();
7575

76-
// A SignalR Hub. https://learn.microsoft.com/en-us/aspnet/core/signalr/hubs?view=aspnetcore-7.0
76+
// A SignalR Hub. https://learn.microsoft.com/en-us/aspnet/core/signalr/hubs?view=aspnetcore-10.0
7777
class MyHub : Hub
7878
{
7979
}
@@ -116,7 +116,7 @@ siloBuilder.UseSignalR();
116116

117117
## Sending messages from Orleans grains
118118

119-
If the SignalR app is cohosted as demonstrated above, you don't need this package to send messages from an Orleans grain. Simply inject `IHubContext<MyHub>` to the grain's constructor and call its methods to send messages. [Read more about it here.](https://learn.microsoft.com/en-us/aspnet/core/signalr/hubcontext?view=aspnetcore-7.0)
119+
If the SignalR app is cohosted as demonstrated above, you don't need this package to send messages from an Orleans grain. Simply inject `IHubContext<MyHub>` to the grain's constructor and call its methods to send messages. [Read more about it here.](https://learn.microsoft.com/en-us/aspnet/core/signalr/hubcontext?view=aspnetcore-10.0)
120120

121121
However, if the SignalR app is not cohosted, and if it's using Orleans as a backplane, then it's possible to use this package to send messages to the SignalR clients using the backplane streams in Orleans as a conduit (ability #2).
122122

@@ -177,13 +177,13 @@ var app = builder.Build();
177177
app.MapHub<MyHub>("/myhub");
178178
await app.RunAsync();
179179

180-
// A SignalR Hub. https://learn.microsoft.com/en-us/aspnet/core/signalr/hubs?view=aspnetcore-7.0
180+
// A SignalR Hub. https://learn.microsoft.com/en-us/aspnet/core/signalr/hubs?view=aspnetcore-10.0
181181
class MyHub : Hub
182182
{
183183
}
184184
```
185185

186-
This is the end of documentation for versions >= 7.0.0. Below is older documenation for previous versions.
186+
This is the end of documentation for versions >= 10.0.0. Below is older documenation for previous versions.
187187

188188
---
189189
# Earlier version documentation

SignalR.Orleans.sln

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
Microsoft Visual Studio Solution File, Format Version 12.00
2-
# Visual Studio Version 17
3-
VisualStudioVersion = 17.5.33209.295
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 18
4+
VisualStudioVersion = 18.2.11415.280 d18.0
45
MinimumVisualStudioVersion = 15.0.26124.0
56
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{20D142F6-AE1A-4AF1-A314-13E6AAF040ED}"
67
EndProject
@@ -14,6 +15,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
1415
ProjectSection(SolutionItems) = preProject
1516
.github\workflows\ci.yml = .github\workflows\ci.yml
1617
Directory.Build.props = Directory.Build.props
18+
Directory.Packages.props = Directory.Packages.props
1719
.github\workflows\publish.yml = .github\workflows\publish.yml
1820
README.md = README.md
1921
README.Nuget.md = README.Nuget.md

samples/Silo/Silo.csproj

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net7.0</TargetFramework>
65
<ImplicitUsings>enable</ImplicitUsings>
76
<Nullable>enable</Nullable>
87
</PropertyGroup>
98

109
<ItemGroup>
11-
<PackageReference Include="Microsoft.Orleans.Server" Version="7.2.0" />
12-
<PackageReference Include="Microsoft.Orleans.Streaming" Version="7.2.0" />
10+
<PackageReference Include="Microsoft.Orleans.Server" />
11+
<PackageReference Include="Microsoft.Orleans.Streaming" />
1312
</ItemGroup>
1413

1514
<ItemGroup>

src/SignalR.Orleans/ServerDirectory/ServerDirectoryGrain.cs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,9 @@ public Task OnActivateAsync(CancellationToken cancellationToken)
3636
_logger.LogInformation("Available servers {serverIds}",
3737
string.Join(", ", _state.State.ServerHeartBeats?.Count > 0 ? string.Join(", ", _state.State.ServerHeartBeats) : "empty"));
3838

39-
_timerRegistry.RegisterTimer(
40-
this.GrainContext,
41-
ValidateAndCleanUp,
42-
_state.State,
43-
TimeSpan.FromSeconds(15),
44-
TimeSpan.FromMinutes(SERVERDIRECTORY_CLEANUP_IN_MINUTES));
39+
_timerRegistry.RegisterGrainTimer(this.GrainContext, ValidateAndCleanUp,
40+
_state.State, new GrainTimerCreationOptions(TimeSpan.FromSeconds(15),
41+
TimeSpan.FromMinutes(SERVERDIRECTORY_CLEANUP_IN_MINUTES)));
4542

4643
return Task.CompletedTask;
4744
}
@@ -62,7 +59,7 @@ public async Task Unregister(Guid serverId)
6259
await _state.WriteStateAsync();
6360
}
6461

65-
private async Task ValidateAndCleanUp(object serverDirectory)
62+
private async Task ValidateAndCleanUp(ServerDirectoryState serverDirectory, CancellationToken token)
6663
{
6764
var inactiveTime = DateTime.UtcNow.AddMinutes(-SERVERDIRECTORY_CLEANUP_IN_MINUTES);
6865
var expiredHeartBeats = _state.State.ServerHeartBeats.Where(heartBeat => heartBeat.Value < inactiveTime).ToList();

src/SignalR.Orleans/SignalR.Orleans.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
<ItemGroup>
1414
<!-- see https://gist.github.com/tebeco/a6e0d9a3885a0a36e702795219bd4fe9 -->
1515
<FrameworkReference Include="Microsoft.AspNetCore.App" />
16-
<PackageReference Include="Microsoft.Orleans.Server" Version="7.2.0" />
17-
<PackageReference Include="Microsoft.Orleans.Streaming" Version="7.2.0" />
16+
<PackageReference Include="Microsoft.Orleans.Server" />
17+
<PackageReference Include="Microsoft.Orleans.Streaming" />
1818
</ItemGroup>
1919

2020
<ItemGroup>

0 commit comments

Comments
 (0)