From 4e955c54b013ed842dc22d7172802c60f7e36a18 Mon Sep 17 00:00:00 2001 From: Mirko Da Corte Date: Wed, 20 Nov 2024 12:50:09 +0100 Subject: [PATCH] update to dotnet 9 --- .github/workflows/myget-unstable-deploy.yml | 3 +- .github/workflows/nuget-stable-deploy.yml | 3 +- .../Auth/Handlers/ValidFiltersHandler.cs | 12 ++------ .../MongODM.AspNetCore.UI.csproj | 4 +-- .../MongODM.AspNetCore.csproj | 4 +-- src/MongODM.Core/MongODM.Core.csproj | 5 ++-- .../Tasks/UpdateDocDependenciesTask.cs | 30 +++++-------------- src/MongODM.Hangfire/MongODM.Hangfire.csproj | 7 ++--- src/MongODM/MongODM.csproj | 4 +-- .../MongODM.Core.Tests.csproj | 4 +-- 10 files changed, 25 insertions(+), 51 deletions(-) diff --git a/.github/workflows/myget-unstable-deploy.yml b/.github/workflows/myget-unstable-deploy.yml index 55be51d..c245f0f 100644 --- a/.github/workflows/myget-unstable-deploy.yml +++ b/.github/workflows/myget-unstable-deploy.yml @@ -21,9 +21,8 @@ jobs: uses: actions/setup-dotnet@v4 with: dotnet-version: | - 6.0.x - 7.0.x 8.0.x + 9.0.x - name: Build with dotnet run: dotnet build --configuration Release diff --git a/.github/workflows/nuget-stable-deploy.yml b/.github/workflows/nuget-stable-deploy.yml index 8a99487..b0795c0 100644 --- a/.github/workflows/nuget-stable-deploy.yml +++ b/.github/workflows/nuget-stable-deploy.yml @@ -19,9 +19,8 @@ jobs: uses: actions/setup-dotnet@v4 with: dotnet-version: | - 6.0.x - 7.0.x 8.0.x + 9.0.x - name: Build with dotnet run: dotnet build --configuration Release diff --git a/src/MongODM.AspNetCore.UI/Auth/Handlers/ValidFiltersHandler.cs b/src/MongODM.AspNetCore.UI/Auth/Handlers/ValidFiltersHandler.cs index 8f42277..37546e6 100644 --- a/src/MongODM.AspNetCore.UI/Auth/Handlers/ValidFiltersHandler.cs +++ b/src/MongODM.AspNetCore.UI/Auth/Handlers/ValidFiltersHandler.cs @@ -19,17 +19,9 @@ namespace Etherna.MongODM.AspNetCore.UI.Auth.Handlers { - internal sealed class ValidFiltersHandler : AuthorizationHandler + internal sealed class ValidFiltersHandler(IHttpContextAccessor httpContextAccessor) + : AuthorizationHandler { - // Fields. - private readonly IHttpContextAccessor httpContextAccessor; - - // Constructor. - public ValidFiltersHandler(IHttpContextAccessor httpContextAccessor) - { - this.httpContextAccessor = httpContextAccessor; - } - // Protected methods. protected override async Task HandleRequirementAsync( AuthorizationHandlerContext context, diff --git a/src/MongODM.AspNetCore.UI/MongODM.AspNetCore.UI.csproj b/src/MongODM.AspNetCore.UI/MongODM.AspNetCore.UI.csproj index 6599356..8c66ab8 100644 --- a/src/MongODM.AspNetCore.UI/MongODM.AspNetCore.UI.csproj +++ b/src/MongODM.AspNetCore.UI/MongODM.AspNetCore.UI.csproj @@ -1,7 +1,7 @@  - net6.0;net7.0;net8.0 + net8.0;net9.0 true true Etherna.MongODM.AspNetCore.UI @@ -29,7 +29,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/MongODM.AspNetCore/MongODM.AspNetCore.csproj b/src/MongODM.AspNetCore/MongODM.AspNetCore.csproj index 07c6b2a..2e8817c 100644 --- a/src/MongODM.AspNetCore/MongODM.AspNetCore.csproj +++ b/src/MongODM.AspNetCore/MongODM.AspNetCore.csproj @@ -1,7 +1,7 @@  - net6.0;net7.0;net8.0 + net8.0;net9.0 true Etherna.MongODM.AspNetCore Etherna SA @@ -29,7 +29,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/MongODM.Core/MongODM.Core.csproj b/src/MongODM.Core/MongODM.Core.csproj index 6efb80a..96f77a3 100644 --- a/src/MongODM.Core/MongODM.Core.csproj +++ b/src/MongODM.Core/MongODM.Core.csproj @@ -1,12 +1,11 @@  - net6.0;net7.0;net8.0 + net8.0;net9.0 true Etherna.MongODM.Core Etherna SA ODM framework for MongoDB - 11.0 enable true AllEnabledByDefault @@ -28,7 +27,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/MongODM.Core/Tasks/UpdateDocDependenciesTask.cs b/src/MongODM.Core/Tasks/UpdateDocDependenciesTask.cs index b52ee6c..9e39780 100644 --- a/src/MongODM.Core/Tasks/UpdateDocDependenciesTask.cs +++ b/src/MongODM.Core/Tasks/UpdateDocDependenciesTask.cs @@ -23,7 +23,6 @@ using Etherna.MongODM.Core.FilterDefinition; using Etherna.MongODM.Core.Repositories; using Etherna.MongODM.Core.Serialization.Mapping; -using Etherna.MongODM.Core.Serialization.Modifiers; using Etherna.MongODM.Core.Utility; using Microsoft.Extensions.Logging; using MoreLinq; @@ -35,24 +34,11 @@ namespace Etherna.MongODM.Core.Tasks { - public class UpdateDocDependenciesTask : IUpdateDocDependenciesTask + public class UpdateDocDependenciesTask( + ILogger logger, + IServiceProvider serviceProvider) + : IUpdateDocDependenciesTask { - // Fields. - private readonly ILogger logger; - private readonly ISerializerModifierAccessor serializerModifierAccessor; - private readonly IServiceProvider serviceProvider; - - // Constructors. - public UpdateDocDependenciesTask( - ILogger logger, - ISerializerModifierAccessor serializerModifierAccessor, - IServiceProvider serviceProvider) - { - this.logger = logger; - this.serializerModifierAccessor = serializerModifierAccessor; - this.serviceProvider = serviceProvider; - } - // Methods. public async Task RunAsync( string referencedRepositoryName, @@ -151,7 +137,7 @@ public async Task RunAsync( var result = typeof(UpdateDocDependenciesTask).GetMethod(nameof(FindUpdatableDocumentsIdAsync), BindingFlags.NonPublic | BindingFlags.Static)! .MakeGenericMethod(originModelType, originIdType) - .Invoke(null, new[] { repository, selectedIdMemberMaps, referencedModelId }); + .Invoke(null, [repository, selectedIdMemberMaps, referencedModelId]); updatableDocumentsIdByRepository.Add(repository, await ((Task>)result!).ConfigureAwait(false)); } @@ -175,14 +161,14 @@ public async Task RunAsync( { foreach (var memberMapPair in repoPair.Value) { - findAndUpdateAsyncMethodInfo.Invoke(null, new object[] - { + findAndUpdateAsyncMethodInfo.Invoke(null, + [ repository, memberMapPair.Key, memberMapPair.Value, updatableDocumentId, referencedModelId - }); + ]); } } } diff --git a/src/MongODM.Hangfire/MongODM.Hangfire.csproj b/src/MongODM.Hangfire/MongODM.Hangfire.csproj index b20fcc6..4957522 100644 --- a/src/MongODM.Hangfire/MongODM.Hangfire.csproj +++ b/src/MongODM.Hangfire/MongODM.Hangfire.csproj @@ -1,12 +1,11 @@  - net6.0;net7.0;net8.0 + net8.0;net9.0 true Etherna.MongODM.HF Etherna SA Linker for use MongoDB with Hangfire - 11.0 enable true AllEnabledByDefault @@ -25,11 +24,11 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/src/MongODM/MongODM.csproj b/src/MongODM/MongODM.csproj index f95ed69..727d72f 100644 --- a/src/MongODM/MongODM.csproj +++ b/src/MongODM/MongODM.csproj @@ -1,7 +1,7 @@  - net6.0;net7.0;net8.0 + net8.0;net9.0 true Etherna.MongODM Etherna SA @@ -24,7 +24,7 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive diff --git a/test/MongODM.Core.Tests/MongODM.Core.Tests.csproj b/test/MongODM.Core.Tests/MongODM.Core.Tests.csproj index 2e289d4..53aa1b6 100644 --- a/test/MongODM.Core.Tests/MongODM.Core.Tests.csproj +++ b/test/MongODM.Core.Tests/MongODM.Core.Tests.csproj @@ -1,7 +1,7 @@  - net8.0 + net9.0 true Etherna.MongODM.Core false @@ -9,7 +9,7 @@ - +