Skip to content

Commit

Permalink
Merge pull request #79 from Etherna/improve/MODM-178-dotnet-9
Browse files Browse the repository at this point in the history
update to dotnet 9
  • Loading branch information
tmm360 authored Nov 20, 2024
2 parents 84374f0 + 4e955c5 commit 4ea24bf
Show file tree
Hide file tree
Showing 10 changed files with 25 additions and 51 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/myget-unstable-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/nuget-stable-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 2 additions & 10 deletions src/MongODM.AspNetCore.UI/Auth/Handlers/ValidFiltersHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,9 @@

namespace Etherna.MongODM.AspNetCore.UI.Auth.Handlers
{
internal sealed class ValidFiltersHandler : AuthorizationHandler<ValidFiltersRequirement>
internal sealed class ValidFiltersHandler(IHttpContextAccessor httpContextAccessor)
: AuthorizationHandler<ValidFiltersRequirement>
{
// Fields.
private readonly IHttpContextAccessor httpContextAccessor;

// Constructor.
public ValidFiltersHandler(IHttpContextAccessor httpContextAccessor)
{
this.httpContextAccessor = httpContextAccessor;
}

// Protected methods.
protected override async Task HandleRequirementAsync(
AuthorizationHandlerContext context,
Expand Down
4 changes: 2 additions & 2 deletions src/MongODM.AspNetCore.UI/MongODM.AspNetCore.UI.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<AddRazorSupportForMvc>true</AddRazorSupportForMvc>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<RootNamespace>Etherna.MongODM.AspNetCore.UI</RootNamespace>
Expand Down Expand Up @@ -29,7 +29,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="GitVersion.MsBuild" Version="5.12.0">
<PackageReference Include="GitVersion.MsBuild" Version="6.0.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
4 changes: 2 additions & 2 deletions src/MongODM.AspNetCore/MongODM.AspNetCore.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<RootNamespace>Etherna.MongODM.AspNetCore</RootNamespace>
<Authors>Etherna SA</Authors>
Expand Down Expand Up @@ -29,7 +29,7 @@

<ItemGroup>
<PackageReference Include="ExecutionContext.AspNetCore" Version="1.3.0" />
<PackageReference Include="GitVersion.MsBuild" Version="5.12.0">
<PackageReference Include="GitVersion.MsBuild" Version="6.0.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
5 changes: 2 additions & 3 deletions src/MongODM.Core/MongODM.Core.csproj
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<RootNamespace>Etherna.MongODM.Core</RootNamespace>
<Authors>Etherna SA</Authors>
<Description>ODM framework for MongoDB</Description>
<LangVersion>11.0</LangVersion>
<Nullable>enable</Nullable>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<AnalysisMode>AllEnabledByDefault</AnalysisMode>
Expand All @@ -28,7 +27,7 @@
<PackageReference Include="Castle.Core" Version="5.1.1" />
<PackageReference Include="Etherna.MongoDB.Driver" Version="3.0.1" />
<PackageReference Include="ExecutionContext" Version="1.3.0" />
<PackageReference Include="GitVersion.MsBuild" Version="5.12.0">
<PackageReference Include="GitVersion.MsBuild" Version="6.0.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
30 changes: 8 additions & 22 deletions src/MongODM.Core/Tasks/UpdateDocDependenciesTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -35,24 +34,11 @@

namespace Etherna.MongODM.Core.Tasks
{
public class UpdateDocDependenciesTask : IUpdateDocDependenciesTask
public class UpdateDocDependenciesTask(
ILogger<UpdateDocDependenciesTask> logger,
IServiceProvider serviceProvider)
: IUpdateDocDependenciesTask
{
// Fields.
private readonly ILogger<UpdateDocDependenciesTask> logger;
private readonly ISerializerModifierAccessor serializerModifierAccessor;
private readonly IServiceProvider serviceProvider;

// Constructors.
public UpdateDocDependenciesTask(
ILogger<UpdateDocDependenciesTask> logger,
ISerializerModifierAccessor serializerModifierAccessor,
IServiceProvider serviceProvider)
{
this.logger = logger;
this.serializerModifierAccessor = serializerModifierAccessor;
this.serviceProvider = serviceProvider;
}

// Methods.
public async Task RunAsync<TDbContext>(
string referencedRepositoryName,
Expand Down Expand Up @@ -151,7 +137,7 @@ public async Task RunAsync<TDbContext>(

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<IEnumerable<object>>)result!).ConfigureAwait(false));
}
Expand All @@ -175,14 +161,14 @@ public async Task RunAsync<TDbContext>(
{
foreach (var memberMapPair in repoPair.Value)
{
findAndUpdateAsyncMethodInfo.Invoke(null, new object[]
{
findAndUpdateAsyncMethodInfo.Invoke(null,
[
repository,
memberMapPair.Key,
memberMapPair.Value,
updatableDocumentId,
referencedModelId
});
]);
}
}
}
Expand Down
7 changes: 3 additions & 4 deletions src/MongODM.Hangfire/MongODM.Hangfire.csproj
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<RootNamespace>Etherna.MongODM.HF</RootNamespace>
<Authors>Etherna SA</Authors>
<Description>Linker for use MongoDB with Hangfire</Description>
<LangVersion>11.0</LangVersion>
<Nullable>enable</Nullable>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<AnalysisMode>AllEnabledByDefault</AnalysisMode>
Expand All @@ -25,11 +24,11 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="GitVersion.MsBuild" Version="5.12.0">
<PackageReference Include="GitVersion.MsBuild" Version="6.0.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Hangfire.Mongo" Version="1.10.9" />
<PackageReference Include="Hangfire.Mongo" Version="1.11.1" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
4 changes: 2 additions & 2 deletions src/MongODM/MongODM.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net7.0;net8.0</TargetFrameworks>
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<RootNamespace>Etherna.MongODM</RootNamespace>
<Authors>Etherna SA</Authors>
Expand All @@ -24,7 +24,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="GitVersion.MsBuild" Version="5.12.0">
<PackageReference Include="GitVersion.MsBuild" Version="6.0.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
Expand Down
4 changes: 2 additions & 2 deletions test/MongODM.Core.Tests/MongODM.Core.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<RootNamespace>Etherna.MongODM.Core</RootNamespace>
<IsPackable>false</IsPackable>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="Moq" Version="4.20.72" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
Expand Down

0 comments on commit 4ea24bf

Please sign in to comment.