Skip to content

Commit 765cf18

Browse files
authored
Merge pull request #12 from VincentH-Net/orleans9
Update to Orleans 9
2 parents 7a052c8 + 01e62da commit 765cf18

20 files changed

+41
-50
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# <img src="img/CSharp-Toolkit-Icon.png" alt="Backend Toolkit" width="64px" />Orleans.Multitenant
2-
Secure, flexible tenant separation for Microsoft Orleans 8
2+
Secure, flexible tenant separation for Microsoft Orleans 9
33

44
> [![Nuget (with prereleases)](https://img.shields.io/nuget/vpre/Orleans.Multitenant?color=gold&label=NuGet:%20Orleans.Multitenant&style=plastic)](https://www.nuget.org/packages/Orleans.Multitenant)<br />
55
> (install in silo client and grain implementation projects)
66
77
_(Note: this repo was transferred from Applicita to VincentH-Net on March 17, 2025 to reflect who actively maintains it)_
88

99
## Summary
10-
[Microsoft Orleans 8](https://github.com/dotnet/orleans/releases/tag/v8.0.0) is a great technology for building distributed, cloud-native applications. It was designed to reduce the complexity of building this type of applications for C# developers.
10+
[Microsoft Orleans 9](https://github.com/dotnet/orleans/releases/tag/v9.0.0) is a great technology for building distributed, cloud-native applications. It was designed to reduce the complexity of building this type of applications for C# developers.
1111

1212
However, creating multi tenant applications with Orleans out of the box requires careful design, complex coding and significant testing to prevent unintentional leakage of communication or stored data across tenants. Orleans.Multitenant adds this capability to Orleans for free, as an uncomplicated, flexible and extensible API that lets developers:
1313

src/Example/Apis/Apis.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717
</PropertyGroup>
1818

1919
<ItemGroup>
20-
<PackageReference Include="Microsoft.Orleans.Persistence.AzureStorage" Version="8.2.0" />
21-
<PackageReference Include="Microsoft.Orleans.Persistence.Memory" Version="8.2.0" />
22-
<PackageReference Include="Microsoft.Orleans.Sdk" Version="8.2.0" />
20+
<PackageReference Include="Microsoft.Orleans.Persistence.AzureStorage" Version="9.1.2" />
21+
<PackageReference Include="Microsoft.Orleans.Persistence.Memory" Version="9.1.2" />
22+
<PackageReference Include="Microsoft.Orleans.Sdk" Version="9.1.2" />
2323
<PackageReference Include="Orleans.Multitenant" Version="2.2.12" />
24-
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.7" />
25-
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.7.0" />
24+
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.14" />
25+
<PackageReference Include="Swashbuckle.AspNetCore" Version="8.0.0" />
2626
</ItemGroup>
2727

2828
<ItemGroup>

src/Example/Apis/Foundation/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
builder.Services.AddEndpointsApiExplorer();
3434
builder.Services.AddSwaggerGen(options => {
3535
options.IncludeXmlComments(Path.Combine(AppContext.BaseDirectory, $"{System.Reflection.Assembly.GetExecutingAssembly().GetName().Name}.xml"));
36-
options.SwaggerDoc("v1", new OpenApiInfo { Title = "Example Orleans 8 Multitenant API", Version = "v1" });
36+
options.SwaggerDoc("v1", new OpenApiInfo { Title = "Example Orleans 9 Multitenant API", Version = "v1" });
3737
options.OperationFilter<TenantHeader.AddAsOpenApiParameter>();
3838
});
3939

src/Example/Contracts/Contracts.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
</PropertyGroup>
1212

1313
<ItemGroup>
14-
<PackageReference Include="Microsoft.Orleans.Sdk" Version="8.2.0" />
14+
<PackageReference Include="Microsoft.Orleans.Sdk" Version="9.1.2" />
1515
</ItemGroup>
1616

1717
</Project>

src/Example/Contracts/Foundation/Result.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Version: 1.0.0 (Using https://semver.org/)
22
// Updated: 2022-11-10
3-
// See https://github.com/Applicita/Orleans.Results for updates to this file.
3+
// See https://github.com/VincentH-Net/Orleans.Results for updates to this file.
44

55
using System.Collections.ObjectModel;
66
using System.Diagnostics.CodeAnalysis;
@@ -17,7 +17,7 @@ public class Result : ResultBase<ErrorNr>
1717
public static Result Ok { get; } = new();
1818

1919
public Result(ImmutableArray<Error> errors) : base(errors) { }
20-
public Result(IEnumerable<Error> errors) : base(ImmutableArray.CreateRange(errors)) { }
20+
public Result(IEnumerable<Error> errors) : base([.. errors]) { }
2121
Result() { }
2222
Result(Error error) : base(error) { }
2323

@@ -34,7 +34,7 @@ public Result(IEnumerable<Error> errors) : base(ImmutableArray.CreateRange(error
3434
public class Result<TValue> : ResultBase<ErrorNr, TValue>
3535
{
3636
public Result(ImmutableArray<Error> errors) : base(errors) { }
37-
public Result(IEnumerable<Error> errors) : base(ImmutableArray.CreateRange(errors)) { }
37+
public Result(IEnumerable<Error> errors) : base([.. errors]) { }
3838
Result(TValue value) : base(value) { }
3939
Result(Error error) : base(error) { }
4040

@@ -49,6 +49,7 @@ public Result(IEnumerable<Error> errors) : base(ImmutableArray.CreateRange(error
4949
[SuppressMessage("Naming", "CA1724:Type names should not match namespaces", Justification = "Namespace is generated by Orleans")]
5050
public abstract class ResultBase<TErrorNr, TValue> : ResultBase<TErrorNr> where TErrorNr : Enum
5151
{
52+
[SuppressMessage("Style", "IDE0032:Use auto property", Justification = "Backing field must be nullable while property is not nullable, different rules are enforced in code for field access versus property access")]
5253
[Id(0)] TValue? value;
5354

5455
protected ResultBase(TValue value) => this.value = value;
@@ -116,6 +117,7 @@ public abstract class ResultBase<TErrorNr> where TErrorNr : Enum
116117
/// <param name="validationErrors">If the return value is true, receives all errors in a dictionary suitable for serializing into a https://tools.ietf.org/html/rfc7807 based format; otherwise set to null</param>
117118
/// <returns>True for a failed result that has the <paramref name="validationErrorFlag"/> set in the <typeparamref name="TErrorNr"/> for <b>all</b> errors; false otherwise</returns>
118119
[SuppressMessage("Style", "IDE0001:Simplify Names", Justification = "Full name is necessary to ensure link in inline documentation works independently of global usings")]
120+
[SuppressMessage("Style", "IDE0306:Simplify collection initialization", Justification = "Dictionary<string, string[]> does not have the required Add method")]
119121
public bool TryAsValidationErrors(TErrorNr validationErrorFlag, [NotNullWhen(true)] out Dictionary<string, string[]>? validationErrors)
120122
{
121123
if (IsFailed && Errors.All(error => error.Nr.HasFlag(validationErrorFlag)))

src/Example/Services.Tenant/Services.Tenant.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
</ItemGroup>
1616

1717
<ItemGroup>
18-
<PackageReference Include="Microsoft.Orleans.Sdk" Version="8.2.0" />
18+
<PackageReference Include="Microsoft.Orleans.Sdk" Version="9.1.2" />
1919
<PackageReference Include="Orleans.Multitenant" Version="2.2.12" />
2020
</ItemGroup>
2121

src/Orleans.Multitenant/Extensions.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using Microsoft.Extensions.Options;
33
using Orleans.Multitenant.Internal;
44
using Orleans.Providers;
5-
using Orleans.Runtime;
65
using Orleans.Storage;
76

87
namespace Orleans.Multitenant;

src/Orleans.Multitenant/Internal/Extensions.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
using Microsoft.Extensions.Options;
66
using Orleans.Configuration;
77
using Orleans.Providers;
8-
using Orleans.Runtime;
98
using Orleans.Storage;
109

1110
namespace Orleans.Multitenant.Internal;

src/Orleans.Multitenant/Internal/Logging.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using Microsoft.Extensions.Logging;
2-
using Orleans.Runtime;
32
using static Orleans.Multitenant.Internal.LoggingParameter;
43
using Event = Orleans.Multitenant.Internal.LoggingEvent;
54

src/Orleans.Multitenant/Internal/SiloLifecycle.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
using System.Collections.Concurrent;
22
using System.Collections.ObjectModel;
33
using Microsoft.Extensions.Logging;
4-
using Orleans.Runtime;
54

65
namespace Orleans.Multitenant.Internal;
76

@@ -130,7 +129,7 @@ async Task OnStart(int lifecycleIndex, CancellationToken ct)
130129
{
131130
int stage = subscriptionsForStage.Key;
132131
logger.ReplayingSiloLifecycleStartForTenant(subscriptionsForStage.Count(), stage);
133-
await Task.WhenAll(subscriptionsForStage.Select(s => s.Observer.OnStart(ct)).ToArray()).ConfigureAwait(false);
132+
await Task.WhenAll([.. subscriptionsForStage.Select(s => s.Observer.OnStart(ct))]).ConfigureAwait(false);
134133
HighestCompletedStage = stage;
135134
}
136135
}
@@ -148,7 +147,7 @@ public async Task OnStop(int lifecycleIndex, CancellationToken ct)
148147
{
149148
int stage = subscriptionsForStage.Key;
150149
logger.ForwardingSiloLifecycleStopForTenant(subscriptionsForStage.Count(), stage);
151-
await Task.WhenAll(subscriptionsForStage.Select(s => s.Observer.OnStop(ct)).ToArray()).ConfigureAwait(false);
150+
await Task.WhenAll([.. subscriptionsForStage.Select(s => s.Observer.OnStop(ct))]).ConfigureAwait(false);
152151
}
153152
}
154153

0 commit comments

Comments
 (0)