From 910af647dc1e8501de2a5b63ea52383ff0db11eb Mon Sep 17 00:00:00 2001 From: Yuuki Wesp Date: Wed, 4 Dec 2024 03:00:39 +0300 Subject: [PATCH 1/4] Configure MessagePack serialization options - Updated namespace in file - Refactored MessagePack serialization configuration to use custom resolver - Added broadcast channel configurations for different scenarios --- .../Features/Orleanse/OrleansExtension.cs | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/Argon.Api/Features/Orleanse/OrleansExtension.cs b/src/Argon.Api/Features/Orleanse/OrleansExtension.cs index d41d267..fad1e69 100644 --- a/src/Argon.Api/Features/Orleanse/OrleansExtension.cs +++ b/src/Argon.Api/Features/Orleanse/OrleansExtension.cs @@ -1,15 +1,13 @@ -namespace Argon.Api.Features; +namespace Argon.Features; using ActualLab.Serialization; -using Argon.Api.Features.Sentry; -using Contracts; using Env; -using Extensions; -using Grains.Interfaces; +using MessagePack.Resolvers; using Orleans.Clustering.Kubernetes; using Orleans.Configuration; using Orleans.Serialization; using OrleansStreamingProviders; +using Sentry; #pragma warning disable ORLEANSEXP001 @@ -17,7 +15,12 @@ public static class OrleansExtension { public static WebApplicationBuilder AddOrleans(this WebApplicationBuilder builder) { - builder.Services.AddSerializer(x => x.AddMessagePackSerializer(null, null, MessagePackByteSerializer.Default.Options)); + var options = MessagePackSerializerOptions.Standard + .WithResolver(CompositeResolver.Create( + DynamicEnumAsStringResolver.Instance, + StandardResolver.Instance)); + MessagePackSerializer.DefaultOptions = options; + builder.Services.AddSerializer(x => x.AddMessagePackSerializer(null, null, MessagePackSerializer.DefaultOptions)); builder.Host.UseOrleans(siloBuilder => { siloBuilder.Configure(builder.Configuration.GetSection("Orleans")) @@ -42,7 +45,8 @@ public static WebApplicationBuilder AddOrleans(this WebApplicationBuilder builde .AddActivationRepartitioner() .AddRedisStorage(IFusionSessionGrain.StorageId, 2) .AddPersistentStreams("default", NatsAdapterFactory.Create, options => { }) - .AddPersistentStreams(IArgonEvent.ProviderId, NatsAdapterFactory.Create, options => { }); + .AddPersistentStreams(IArgonEvent.ProviderId, NatsAdapterFactory.Create, options => { }) + .AddBroadcastChannel(IArgonEvent.Broadcast); } else { @@ -50,7 +54,8 @@ public static WebApplicationBuilder AddOrleans(this WebApplicationBuilder builde .UseLocalhostClustering() .AddMemoryStreams("default") .AddMemoryStreams(IArgonEvent.ProviderId) - .AddMemoryGrainStorage(IFusionSessionGrain.StorageId); + .AddMemoryGrainStorage(IFusionSessionGrain.StorageId) + .AddBroadcastChannel(IArgonEvent.Broadcast); } }); From 76a275e0df14dfa3c087fc187dea62ad4aafa1bf Mon Sep 17 00:00:00 2001 From: Yuuki Wesp Date: Wed, 4 Dec 2024 03:01:23 +0300 Subject: [PATCH 2/4] Update code formatting rules for C# and .NET projects - Added new C# code style preferences - Updated operator placement and expression styles - Changed project references in solution file - Increased next version to "0.3" in GitVersion configuration --- .editorconfig | 32 ++++++++++++++++++++++++++++++++ Argon.Server.sln | 4 ++-- GitVersion.yml | 2 +- 3 files changed, 35 insertions(+), 3 deletions(-) diff --git a/.editorconfig b/.editorconfig index 01cfe6e..ba24e8e 100644 --- a/.editorconfig +++ b/.editorconfig @@ -14,6 +14,23 @@ ij_formatter_tags_enabled = true ij_smart_tabs = false ij_visual_guides = ij_wrap_on_typing = false +csharp_indent_labels = no_change +csharp_using_directive_placement = inside_namespace:warning +csharp_prefer_simple_using_statement = true:suggestion +csharp_prefer_braces = true:silent +csharp_style_namespace_declarations = file_scoped:silent +csharp_style_prefer_method_group_conversion = true:silent +csharp_style_prefer_top_level_statements = true:silent +csharp_style_prefer_primary_constructors = true:suggestion +csharp_prefer_system_threading_lock = true:suggestion +csharp_style_expression_bodied_methods = false:silent +csharp_style_expression_bodied_constructors = false:silent +csharp_style_expression_bodied_operators = false:silent +csharp_style_expression_bodied_properties = true:silent +csharp_style_expression_bodied_indexers = true:silent +csharp_style_expression_bodied_accessors = true:silent +csharp_style_expression_bodied_lambdas = true:silent +csharp_style_expression_bodied_local_functions = false:silent [*.{csproj}] charset = utf-8-bom @@ -379,3 +396,18 @@ indent_style = space indent_style = space indent_size = 4 tab_width = 4 +dotnet_style_operator_placement_when_wrapping = beginning_of_line +dotnet_style_coalesce_expression = true:suggestion +dotnet_style_null_propagation = true:suggestion +dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion +dotnet_style_prefer_auto_properties = true:silent +dotnet_style_object_initializer = true:suggestion +dotnet_style_collection_initializer = true:suggestion +dotnet_style_prefer_simplified_boolean_expressions = true:suggestion +dotnet_style_prefer_conditional_expression_over_assignment = true:silent +dotnet_style_prefer_conditional_expression_over_return = true:silent +dotnet_style_explicit_tuple_names = true:suggestion +dotnet_style_prefer_inferred_tuple_names = true:suggestion +dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion +dotnet_style_prefer_compound_assignment = true:suggestion +dotnet_style_prefer_simplified_interpolation = true:suggestion diff --git a/Argon.Server.sln b/Argon.Server.sln index cc4e219..a52b763 100644 --- a/Argon.Server.sln +++ b/Argon.Server.sln @@ -16,11 +16,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution .editorconfig = .editorconfig .gitignore = .gitignore .gitmodules = .gitmodules - GitVersion.yml = GitVersion.yml src\AppHost\aspirate-output\docker-compose.yaml = src\AppHost\aspirate-output\docker-compose.yaml + GitVersion.yml = GitVersion.yml EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Argon.Contracts", "src\Argon.Contracts\Argon.Contracts.csproj", "{151002BD-57E5-440B-9CA7-C681A69CA02C}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Argon.Shared", "src\Argon.Contracts\Argon.Shared.csproj", "{151002BD-57E5-440B-9CA7-C681A69CA02C}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{90798FD4-3C62-4AE1-ADE9-F5EC4A0FD4B1}" EndProject diff --git a/GitVersion.yml b/GitVersion.yml index 36b46c8..c445be0 100644 --- a/GitVersion.yml +++ b/GitVersion.yml @@ -5,4 +5,4 @@ merge-message-formats: { } commit-message-incrementing: Enabled patch-version-bump-message: "^(add|bump|drop|mv|move|update|expose|remove|refactoring|additional|use|improvement|fix|refactor)(.+)?" tag-prefix: 'IGNORE' -next-version: "0.1" \ No newline at end of file +next-version: "0.3" \ No newline at end of file From 69cb0bdcd4ae09383b8aa5a9521c1007673c598c Mon Sep 17 00:00:00 2001 From: Yuuki Wesp Date: Wed, 4 Dec 2024 03:01:30 +0300 Subject: [PATCH 3/4] Remove redundant IIS Express settings and update HTTP profile. Details: - Removed unnecessary IIS Express settings - Updated HTTP profile with correct application URL and removed duplicate environment variables --- src/Argon.Api/Properties/launchSettings.json | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/src/Argon.Api/Properties/launchSettings.json b/src/Argon.Api/Properties/launchSettings.json index b55cb6b..b970aee 100644 --- a/src/Argon.Api/Properties/launchSettings.json +++ b/src/Argon.Api/Properties/launchSettings.json @@ -1,28 +1,11 @@ { "$schema": "http://json.schemastore.org/launchsettings.json", - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:64259", - "sslPort": 44394 - } - }, "profiles": { "http": { "commandName": "Project", "dotnetRunMessages": true, "launchBrowser": false, "launchUrl": "swagger", - "applicationUrl": "http://localhost:5100", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": false, - "launchUrl": "swagger", "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" } From d8d713b174fae43245d0fc4c838b48d8441b4f18 Mon Sep 17 00:00:00 2001 From: Yuuki Wesp Date: Wed, 4 Dec 2024 03:01:36 +0300 Subject: [PATCH 4/4] Remove unused SignalR service and add DataProtection feature Removed an unused SignalR service and added a DataProtection feature to the program setup in Program.cs. --- src/Argon.Api/Program.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Argon.Api/Program.cs b/src/Argon.Api/Program.cs index 43adce6..1ddd60c 100644 --- a/src/Argon.Api/Program.cs +++ b/src/Argon.Api/Program.cs @@ -71,7 +71,6 @@ builder.AddEfRepositories(); builder.AddKubeResources(); builder.AddCaptchaFeature(); -builder.Services.AddSignalR(); builder.Services.AddDataProtection(); var app = builder.Build();