Skip to content

Commit 9928e55

Browse files
authored
Merge pull request #2 from VincentH-Net/net-9-orleans-9
Update to C# 13, .NET 9 and Orleans 9
2 parents 2faa829 + eb79be9 commit 9928e55

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+141
-226
lines changed

.editorconfig

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# Version 20240405 - C# 12
2-
# Origin: see https://github.com/Applicita/Modern.CSharp.Templates/blob/main/Editorconfig.md
1+
# Version 20250331 - C# 13
2+
# Origin: see https://github.com/VincentH-Net/Modern.CSharp.Templates/blob/main/Editorconfig.md
33

44
# This file does not inherit .editorconfig settings from higher directories - where possible, place it at the root of the repository
55

@@ -14,7 +14,7 @@
1414

1515
# References:
1616
# - To learn more about .editorconfig see https://aka.ms/editorconfigdocs
17-
# - Set rule severity https://docs.microsoft.com/en-us/visualstudio/code-quality/use-roslyn-analyzers?view=vs-2019#set-rule-severity-in-an-editorconfig-file
17+
# - Set rule severity https://learn.microsoft.com/en-us/visualstudio/code-quality/use-roslyn-analyzers?view=vs-2022#set-rule-severity-in-an-editorconfig-file
1818
# - Configure analyzer rules https://github.com/dotnet/roslyn-analyzers/blob/main/docs/Analyzer%20Configuration.md
1919

2020
# Note that choices to deviate from the default are governed by these goals:
@@ -49,6 +49,9 @@ tab_width = 2
4949
indent_size = 4
5050
tab_width = 4
5151

52+
# See https://github.com/dotnet/roslyn/issues/68413#issuecomment-1943805603
53+
trim_trailing_whitespace = false
54+
5255
# New line preferences
5356
insert_final_newline = true # Default: false
5457

@@ -174,6 +177,11 @@ csharp_using_directive_placement = outside_namespace:warning # Default: outside_
174177
# It can also make attribute usage more concise
175178
# See https://stackoverflow.com/questions/125319/should-using-directives-be-inside-or-outside-the-namespace
176179

180+
# Preferences added with .NET 9 / C# 13
181+
csharp_prefer_system_threading_lock = true:warning # Default: true:suggestion
182+
csharp_style_prefer_unbound_generic_type_in_nameof = true:warning # Default: true:suggestion
183+
csharp_prefer_static_anonymous_function = true:warning # Default: true:suggestion
184+
177185
# New line preferences
178186
csharp_style_allow_blank_line_after_colon_in_constructor_initializer_experimental = true:silent
179187
csharp_style_allow_blank_line_after_token_in_arrow_expression_clause_experimental = true:silent
@@ -314,6 +322,3 @@ dotnet_diagnostic.IDE0072.severity = suggestion
314322
# while truly unexpected returns should throw an exception. Since switch automatically throws a SwitchExpressionException,
315323
# it is valid to not explicitly code cases that throw an exception to indicate the return is truly unexpected.
316324
dotnet_diagnostic.IDE0130.severity = suggestion # IDE0130 "Namespace does not match folder structure" can be deviated from to prevent overstructuring
317-
318-
# Solution-specific settings
319-
dotnet_diagnostic.ORLEANS0010.severity = none # adding an alias to every grain contract type and member adds too much noise. This rule should be triggered only during refactoring

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# <img src="img/CSharp-Toolkit-Icon.png" alt="Backend Toolkit" width="64px" />Orleans.Multiservice
2-
Prevent microservices pain with logical service separation in a modular monolith for [Microsoft Orleans 8](https://learn.microsoft.com/en-us/dotnet/orleans/)
2+
Prevent microservices pain with logical service separation in a modular monolith for [Microsoft Orleans 9](https://learn.microsoft.com/en-us/dotnet/orleans/)
33

44
Orleans.Multiservice is an automated code structuring pattern for logical service separation within a Microsoft Orleans (micro)service.
55

@@ -28,9 +28,9 @@ Orleans.Multiservice consists of:
2828
- An example application that demonstrates the pattern in 2 stages of the application's life cycle:
2929

3030
1) The application starts out as a single microservice, built by a single team, that contains two logical services - one of which depends on the other<br />
31-
Source: [Single Team/Microservice eShop](https://github.com/Applicita/Orleans.Multiservice/tree/main/src/Example/eShopBySingleTeam/TeamA)
31+
Source: [Single Team/Microservice eShop](https://github.com/VincentH-Net/Orleans.Multiservice/tree/main/src/Example/eShopBySingleTeam/TeamA)
3232
2) Then a second team is added that will become owner of one of the logical services. A second microservice is added and one logical service is moved into that (in a real world application this could also be moving 5 out of 10 logical services to a second microservice)<br />
33-
Source: [Two Team/Microservice eShop](https://github.com/Applicita/Orleans.Multiservice/tree/main/src/Example/eShopByTwoTeams)
33+
Source: [Two Team/Microservice eShop](https://github.com/VincentH-Net/Orleans.Multiservice/tree/main/src/Example/eShopByTwoTeams)
3434

3535
- A `dotnet new mcs-orleans-multiservice` template to set up a new multiservice, and to add a logical service in an existing multiservice
3636

@@ -39,7 +39,7 @@ Orleans.Multiservice consists of:
3939
> The code analyzer / unit tests will be added in a future release. Note that the multiservice pattern can be used without the analyzer by following the code structure of the template and the [pattern rules](#pattern-rules)
4040
4141
## Template usage
42-
1) On the command line, ensure that the [mcs-orleans-multiservice template](https://github.com/Applicita/Modern.CSharp.Templates#readme) is installed:
42+
1) On the command line, ensure that the [mcs-orleans-multiservice template](https://github.com/VincentH-Net/Modern.CSharp.Templates#readme) is installed:
4343
```
4444
dotnet new install Modern.CSharp.Templates
4545
```
@@ -52,7 +52,7 @@ Orleans.Multiservice consists of:
5252
5353
3) To create a new multiservice with one logical service in it, enter e.g.:
5454
```
55-
dotnet new mcs-orleans-multiservice --RootNamespace Applicita.eShop --Multiservice TeamA --Logicalservice Catalog --allow-scripts Yes
55+
dotnet new mcs-orleans-multiservice --RootNamespace InnoWvateDotNet.eShop --Multiservice TeamA --Logicalservice Catalog --allow-scripts Yes
5656
```
5757
5858
4) To add a logical service to an existing multiservice solution, type e.g. this command in PowerShell while in the solution folder:
@@ -81,13 +81,13 @@ The only code change needed to move the `CatalogService` to the Team B microserv
8181
8282
### How to run the example
8383
Single team solution:
84-
- Debug [eShopTeamA.sln](https://github.com/Applicita/Orleans.Multiservice/tree/main/src/Example/eShopBySingleTeam/TeamA)
84+
- Debug [eShopTeamA.sln](https://github.com/VincentH-Net/Orleans.Multiservice/tree/main/src/Example/eShopBySingleTeam/TeamA)
8585
8686
Two team solution:
87-
- Ensure you have the latest [.NET OpenAPI tool](https://learn.microsoft.com/en-us/aspnet/core/web-api/microsoft.dotnet-openapi?view=aspnetcore-8.0) for .NET 8 installed:<br />
87+
- Ensure you have the latest [.NET OpenAPI tool](https://learn.microsoft.com/en-us/aspnet/core/fundamentals/openapi/openapi-tools?view=aspnetcore-9.0) for .NET 9 installed:<br />
8888
`dotnet tool install --global Microsoft.dotnet-openapi`<br />
8989
On build, this will generate the `CatalogServiceClient` from `CatalogService.json`
90-
- Debug [eShopTeamAof2.sln](https://github.com/Applicita/Orleans.Multiservice/tree/main/src/Example/eShopByTwoTeams/TeamA) and [eShopTeamBof2.sln](https://github.com/Applicita/Orleans.Multiservice/tree/main/src/Example/eShopByTwoTeams/TeamB)
90+
- Debug [eShopTeamAof2.sln](https://github.com/VincentH-Net/Orleans.Multiservice/tree/main/src/Example/eShopByTwoTeams/TeamA) and [eShopTeamBof2.sln](https://github.com/VincentH-Net/Orleans.Multiservice/tree/main/src/Example/eShopByTwoTeams/TeamB)
9191
9292
### How to test the example
9393
When testing the API in the generated swagger UI, you can use any integer for `buyerId`.

src/Example/eShopBySingleTeam/TeamA/AddLogicalService.ps1

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

77
# Function to update the Program.cs file to add a new parameter to the RegisterEndpoints method
88
function Update-RegisterEndpoints {
9-
$newParameter = "`n typeof(Applicita.eShop.Apis.${Name}Api.${Name}Endpoints)`n"
9+
$newParameter = "`n typeof(InnoWvateDotNet.eShop.Apis.${Name}Api.${Name}Endpoints)`n"
1010
$apisDirectory = Join-Path -Path $PWD -ChildPath "Apis"
1111
$programFile = Get-ChildItem -Path $apisDirectory -Recurse -Filter "Program.cs" -ErrorAction SilentlyContinue | Select-Object -First 1
1212

@@ -25,6 +25,6 @@ function Update-RegisterEndpoints {
2525
Write-Warning "Could not automatically add below parameter to the RegisterEndpoints(...) call; please add it manually:$newParameter"
2626
}
2727

28-
dotnet new mcs-orleans-multiservice --RootNamespace Applicita.eShop -M . --Logicalservice $Name --allow-scripts Yes
28+
dotnet new mcs-orleans-multiservice --RootNamespace InnoWvateDotNet.eShop -M . --Logicalservice $Name --allow-scripts Yes
2929

3030
Update-RegisterEndpoints

src/Example/eShopBySingleTeam/TeamA/Apis/Apis.csproj

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>net8.0</TargetFramework>
4+
<TargetFramework>net9.0</TargetFramework>
55
<Nullable>enable</Nullable>
66
<ImplicitUsings>enable</ImplicitUsings>
77

88
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
99
<AnalysisLevel>preview-All</AnalysisLevel>
1010
<EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>
1111

12-
<AssemblyName>Applicita.eShop.$(MSBuildProjectName).TeamA</AssemblyName>
13-
<RootNamespace>Applicita.eShop.$(MSBuildProjectName.Replace(" ", "_"))</RootNamespace>
12+
<AssemblyName>InnoWvateDotNet.eShop.$(MSBuildProjectName).TeamA</AssemblyName>
13+
<RootNamespace>InnoWvateDotNet.eShop.$(MSBuildProjectName.Replace(" ", "_"))</RootNamespace>
1414
</PropertyGroup>
1515

1616
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
@@ -19,10 +19,10 @@
1919
</PropertyGroup>
2020

2121
<ItemGroup>
22-
<PackageReference Include="Microsoft.Orleans.Persistence.Memory" Version="8.0.0" />
23-
<PackageReference Include="Microsoft.Orleans.Sdk" Version="8.0.0" />
24-
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.3" />
25-
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
22+
<PackageReference Include="Microsoft.Orleans.Persistence.Memory" Version="9.1.2" />
23+
<PackageReference Include="Microsoft.Orleans.Sdk" Version="9.1.2" />
24+
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="9.0.3" />
25+
<PackageReference Include="Swashbuckle.AspNetCore" Version="8.0.0" />
2626
</ItemGroup>
2727

2828
<ItemGroup>

src/Example/eShopBySingleTeam/TeamA/Apis/BasketApi/BasketsEndpoints.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
using Applicita.eShop.Contracts.BasketContract;
1+
using InnoWvateDotNet.eShop.Contracts.BasketContract;
22

3-
namespace Applicita.eShop.Apis.BasketApi;
3+
namespace InnoWvateDotNet.eShop.Apis.BasketApi;
44

55
public class BasketsEndpoints(IClusterClient orleans) : IEndpoints
66
{

src/Example/eShopBySingleTeam/TeamA/Apis/CatalogApi/CatalogEndpoints.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
using Applicita.eShop.Contracts.CatalogContract;
1+
using InnoWvateDotNet.eShop.Contracts.CatalogContract;
22

3-
namespace Applicita.eShop.Apis.CatalogApi;
3+
namespace InnoWvateDotNet.eShop.Apis.CatalogApi;
44

55
public class CatalogEndpoints(IClusterClient orleans) : IEndpoints
66
{

src/Example/eShopBySingleTeam/TeamA/Apis/Foundation/Extensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace Applicita.eShop.Apis.Foundation;
1+
namespace InnoWvateDotNet.eShop.Apis.Foundation;
22

33
public interface IEndpoints
44
{
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
global using System.Collections.Immutable;
22
global using Microsoft.AspNetCore.Http.HttpResults;
33
global using static Microsoft.AspNetCore.Http.TypedResults;
4-
global using Applicita.eShop.Apis.Foundation;
4+
global using InnoWvateDotNet.eShop.Apis.Foundation;

src/Example/eShopBySingleTeam/TeamA/Apis/Foundation/Program.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
_ = app.UseSwagger().UseSwaggerUI(options => options.EnableTryItOutByDefault());
2020

2121
app.RegisterEndpoints(
22-
typeof(Applicita.eShop.Apis.BasketApi.BasketsEndpoints),
23-
typeof(Applicita.eShop.Apis.CatalogApi.CatalogEndpoints)
22+
typeof(InnoWvateDotNet.eShop.Apis.BasketApi.BasketsEndpoints),
23+
typeof(InnoWvateDotNet.eShop.Apis.CatalogApi.CatalogEndpoints)
2424
);
2525

2626
app.Run();

src/Example/eShopBySingleTeam/TeamA/BasketService/BasketGrain.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using System.Collections.Immutable;
22
using System.Globalization;
33

4-
namespace Applicita.eShop.BasketService;
4+
namespace InnoWvateDotNet.eShop.BasketService;
55

66
sealed class BasketGrain : Grain, IBasketGrain
77
{

0 commit comments

Comments
 (0)