Skip to content

Commit

Permalink
#221 Migrate to .NET 8 (#222)
Browse files Browse the repository at this point in the history
* #221 Migrate to .NET 8
  • Loading branch information
nkz-soft authored Apr 4, 2024
1 parent 9ea28ef commit a3630a3
Show file tree
Hide file tree
Showing 35 changed files with 119 additions and 220 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-by-branch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
- name: Setup .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
dotnet-version: 8.0.x
- name: Caching dependencies
uses: actions/cache@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-by-tag.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Setup .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: 7.0.x
dotnet-version: 8.0.x
- name: Restore Dependencies
run: dotnet restore
- name: Build
Expand Down
6 changes: 5 additions & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<LangVersion>latest</LangVersion>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
Expand All @@ -23,6 +23,10 @@
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
</PropertyGroup>

<PropertyGroup>
<NoWarn>$(NoWarn);NETSDK1206;xUnit1028</NoWarn>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" PrivateAssets="All"/>
</ItemGroup>
Expand Down
138 changes: 69 additions & 69 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,111 +3,111 @@
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Ardalis.Specification.EntityFrameworkCore" Version="7.0.0" />
<PackageVersion Include="AspNetCore.HealthChecks.Redis" Version="7.0.0" />
<PackageVersion Include="Ardalis.Specification.EntityFrameworkCore" Version="8.0.0" />
<PackageVersion Include="AspNetCore.HealthChecks.Redis" Version="8.0.1" />
<PackageVersion Include="EasyCaching.Core" Version="1.9.0" />
<PackageVersion Include="EasyCaching.Serialization.MessagePack" Version="1.9.0" />
<PackageVersion Include="FluentValidation" Version="11.6.0" />
<PackageVersion Include="FluentValidation" Version="11.9.0" />
<PackageVersion Include="HotChocolate.Abstractions" Version="13.4.0" />
<PackageVersion Include="HotChocolate.Diagnostics" Version="13.4.0" />
<PackageVersion Include="HotChocolate.AspNetCore" Version="13.4.0" />
<PackageVersion Include="HotChocolate.Data" Version="13.4.0" />
<PackageVersion Include="HotChocolate.Data.EntityFramework" Version="13.4.0" />
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.1" />
<PackageVersion Include="HotChocolate.Diagnostics" Version="13.9.0" />
<PackageVersion Include="HotChocolate.AspNetCore" Version="13.9.0" />
<PackageVersion Include="HotChocolate.Data" Version="13.9.0" />
<PackageVersion Include="HotChocolate.Data.EntityFramework" Version="13.9.0" />
<PackageVersion Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.1" />
<PackageVersion Include="NKZSoft.FluentValidation.Options" Version="1.1.0" />
<PackageVersion Include="Npgsql.OpenTelemetry" Version="7.0.4" />
<PackageVersion Include="OpenTelemetry" Version="1.5.1" />
<PackageVersion Include="OpenTelemetry.Api" Version="1.5.1" />
<PackageVersion Include="OpenTelemetry.Exporter.Console" Version="1.5.1" />
<PackageVersion Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.5.1" />
<PackageVersion Include="OpenTelemetry.Extensions.Hosting" Version="1.5.1" />
<PackageVersion Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.0.0-rc9.14" />
<PackageVersion Include="Npgsql.OpenTelemetry" Version="8.0.2" />
<PackageVersion Include="OpenTelemetry" Version="1.8.0" />
<PackageVersion Include="OpenTelemetry.Api" Version="1.8.0" />
<PackageVersion Include="OpenTelemetry.Exporter.Console" Version="1.8.0" />
<PackageVersion Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.8.0" />
<PackageVersion Include="OpenTelemetry.Extensions.Hosting" Version="1.8.0" />
<PackageVersion Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.7.1" />
<PackageVersion Include="OpenTelemetry.Instrumentation.EntityFrameworkCore" Version="1.0.0-beta.6" />
<PackageVersion Include="OpenTelemetry.Instrumentation.Http" Version="1.0.0-rc9.14" />
<PackageVersion Include="OpenTelemetry.Instrumentation.Http" Version="1.7.1" />
<PackageVersion Include="OpenTelemetry.Instrumentation.MassTransit" Version="1.0.0-beta.3" />
<PackageVersion Include="OpenTelemetry.Instrumentation.GrpcNetClient" Version="1.0.0-rc9.14" />
<PackageVersion Include="StackExchange.Redis" Version="2.6.122" />
<PackageVersion Include="EasyCaching.Redis" Version="1.9.0" />
<PackageVersion Include="System.ServiceModel.Primitives" Version="6.0.0" />
<PackageVersion Include="AspNetCore.HealthChecks.UI.Client" Version="6.0.5" />
<PackageVersion Include="AspNetCore.HealthChecks.Rabbitmq" Version="6.0.2" />
<PackageVersion Include="StackExchange.Redis" Version="2.7.33" />
<PackageVersion Include="EasyCaching.Redis" Version="1.9.2" />
<PackageVersion Include="System.ServiceModel.Primitives" Version="8.0.0" />
<PackageVersion Include="AspNetCore.HealthChecks.UI.Client" Version="8.0.1" />
<PackageVersion Include="AspNetCore.HealthChecks.Rabbitmq" Version="8.0.1" />
<PackageVersion Include="Microsoft.NETCore.Platforms" Version="7.0.4" />
<PackageVersion Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="7.0.9" />
<PackageVersion Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.0.3" />
<PackageVersion Include="Microsoft.AspNetCore.Http.Abstractions" Version="2.2.0" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="1.1.1" />
<PackageVersion Include="Microsoft.Extensions.Configuration.Abstractions" Version="7.0.0" />
<PackageVersion Include="Microsoft.Extensions.Configuration.Binder" Version="7.0.4" />
<PackageVersion Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="7.0.0" />
<PackageVersion Include="Microsoft.Extensions.Configuration.FileExtensions" Version="7.0.0" />
<PackageVersion Include="Microsoft.Extensions.Configuration.Json" Version="7.0.0" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="7.0.0" />
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="7.0.9" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Design" Version="7.0.9">
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.1" />
<PackageVersion Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Configuration.FileExtensions" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.1" />
<PackageVersion Include="Microsoft.EntityFrameworkCore" Version="8.0.3" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageVersion>
<PackageVersion Include="Microsoft.EntityFrameworkCore.Relational" Version="7.0.9" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Relational" Version="8.0.3" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.Relational.Design" Version="1.1.6" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.InMemory" Version="7.0.9" />
<PackageVersion Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="7.0.4" />
<PackageVersion Include="Microsoft.EntityFrameworkCore.InMemory" Version="8.0.3" />
<PackageVersion Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.2" />
<PackageVersion Include="Npgsql.EntityFrameworkCore.PostgreSQL.Design" Version="1.1.0" />
<PackageVersion Include="EFCoreSecondLevelCacheInterceptor" Version="3.9.2" />
<PackageVersion Include="AspNetCore.HealthChecks.NpgSql" Version="6.0.2" />
<PackageVersion Include="EFCoreSecondLevelCacheInterceptor" Version="4.3.1" />
<PackageVersion Include="AspNetCore.HealthChecks.NpgSql" Version="8.0.1" />
<PackageVersion Include="Microsoft.AspNetCore.SignalR" Version="1.1.0" />
<PackageVersion Include="Microsoft.AspNetCore.SignalR.Client" Version="7.0.9" />
<PackageVersion Include="Ardalis.GuardClauses" Version="4.0.1" />
<PackageVersion Include="Ardalis.Specification" Version="7.0.0" />
<PackageVersion Include="Microsoft.AspNetCore.SignalR.Client" Version="8.0.3" />
<PackageVersion Include="Ardalis.GuardClauses" Version="4.5.0" />
<PackageVersion Include="Ardalis.Specification" Version="8.0.0" />
<PackageVersion Include="Scrutor" Version="4.2.2" />
<PackageVersion Include="MediatR" Version="12.1.1" />
<PackageVersion Include="MediatR" Version="12.2.0" />
<PackageVersion Include="MediatR.Extensions.Microsoft.DependencyInjection" Version="11.1.0" />
<PackageVersion Include="MassTransit" Version="8.0.16" />
<PackageVersion Include="MassTransit.AspNetCore" Version="7.3.1" />
<PackageVersion Include="MassTransit.Extensions.DependencyInjection" Version="7.3.1" />
<PackageVersion Include="MassTransit.RabbitMQ" Version="8.0.15" />
<PackageVersion Include="FluentResults" Version="3.15.2" />
<PackageVersion Include="FluentValidation.DependencyInjectionExtensions" Version="11.6.0" />
<PackageVersion Include="Mapster" Version="7.3.0" />
<PackageVersion Include="Mapster.Async" Version="2.0.0" />
<PackageVersion Include="Mapster.DependencyInjection" Version="1.0.0" />
<PackageVersion Include="Google.Protobuf" Version="3.23.4" />
<PackageVersion Include="protobuf-net" Version="3.2.26" />
<PackageVersion Include="FluentValidation.DependencyInjectionExtensions" Version="11.9.0" />
<PackageVersion Include="Mapster" Version="7.4.0" />
<PackageVersion Include="Mapster.Async" Version="2.0.1" />
<PackageVersion Include="Mapster.DependencyInjection" Version="1.0.1" />
<PackageVersion Include="Google.Protobuf" Version="3.26.1" />
<PackageVersion Include="protobuf-net" Version="3.2.30" />
<PackageVersion Include="protobuf-net.Grpc.AspNetCore" Version="1.1.1" />
<PackageVersion Include="protobuf-net.Grpc.AspNetCore.Reflection" Version="1.1.1" />
<PackageVersion Include="protobuf-net.Reflection" Version="3.2.12" />
<PackageVersion Include="Grpc.Net.ClientFactory" Version="2.55.0" />
<PackageVersion Include="Serilog" Version="3.0.1" />
<PackageVersion Include="Serilog.Extensions.Logging" Version="7.0.0" />
<PackageVersion Include="Serilog.Extensions.Hosting" Version="7.0.0" />
<PackageVersion Include="Serilog.Sinks.Console" Version="4.1.0" />
<PackageVersion Include="Serilog.AspNetCore" Version="7.0.0" />
<PackageVersion Include="Grpc.Net.ClientFactory" Version="2.62.0" />
<PackageVersion Include="Serilog" Version="3.1.1" />
<PackageVersion Include="Serilog.Extensions.Logging" Version="8.0.0" />
<PackageVersion Include="Serilog.Extensions.Hosting" Version="8.0.0" />
<PackageVersion Include="Serilog.Sinks.Console" Version="5.0.1" />
<PackageVersion Include="Serilog.AspNetCore" Version="8.0.1" />
<PackageVersion Include="FluentValidation.AspNetCore" Version="11.3.0" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="7.0.9" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.6.3" />
<PackageVersion Include="xunit" Version="2.5.0" />
<PackageVersion Include="Microsoft.AspNetCore.Mvc.Testing" Version="8.0.3" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
<PackageVersion Include="xunit" Version="2.7.0" />
<PackageVersion Include="Xunit.Extensions.Ordering" Version="1.4.5" />
<PackageVersion Include="Xunit.DependencyInjection" Version="8.7.2" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.0">
<PackageVersion Include="Xunit.DependencyInjection" Version="9.1.0" />
<PackageVersion Include="xunit.runner.visualstudio" Version="2.5.7">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageVersion>
<PackageVersion Include="xunit.extensibility.core" Version="2.5.0" />
<PackageVersion Include="coverlet.collector" Version="6.0.0">
<PackageVersion Include="xunit.extensibility.core" Version="2.7.0" />
<PackageVersion Include="coverlet.collector" Version="6.0.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageVersion>
<PackageVersion Include="FluentAssertions" Version="6.11.0" />
<PackageVersion Include="Respawn" Version="6.1.0" />
<PackageVersion Include="Moq" Version="4.18.4" />
<PackageVersion Include="Testcontainers" Version="3.3.0" />
<PackageVersion Include="Testcontainers.PostgreSql" Version="3.3.0" />
<PackageVersion Include="Testcontainers.RabbitMq" Version="3.3.0" />
<PackageVersion Include="Testcontainers.Redis" Version="3.3.0" />
<PackageVersion Include="FluentAssertions" Version="6.12.0" />
<PackageVersion Include="Respawn" Version="6.2.1" />
<PackageVersion Include="Moq" Version="4.20.70" />
<PackageVersion Include="Testcontainers" Version="3.8.0" />
<PackageVersion Include="Testcontainers.PostgreSql" Version="3.8.0" />
<PackageVersion Include="Testcontainers.RabbitMq" Version="3.8.0" />
<PackageVersion Include="Testcontainers.Redis" Version="3.8.0" />
<PackageVersion Include="Shouldly" Version="4.2.1" />
<PackageVersion Include="RestSharp" Version="110.2.0" />
<PackageVersion Include="NKZSoft.Service.Configuration.MassTransit.RabbitMq" Version="1.1.0" />
<PackageVersion Include="NKZSoft.Service.Configuration.Logger" Version="1.2.0" />
<PackageVersion Include="NKZSoft.Service.Configuration.Swagger" Version="1.0.2" />
<PackageVersion Include="NKZSoft.Service.Configuration.Logger" Version="1.2.1" />
<PackageVersion Include="NKZSoft.Service.Configuration.Swagger" Version="1.0.3" />
<PackageVersion Include="NKZSoft.Service.Configuration.Grpc" Version="1.0.0" />
<PackageVersion Include="EasyCaching.Serialization.Json" Version="1.9.0" />
<PackageVersion Include="EasyCaching.Serialization.Json" Version="1.9.2" />
</ItemGroup>
</Project>
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM mcr.microsoft.com/dotnet/nightly/aspnet:7.0-jammy-chiseled
FROM mcr.microsoft.com/dotnet/nightly/aspnet:8.0-jammy-chiseled
EXPOSE 8080
EXPOSE 8081

Expand Down
12 changes: 12 additions & 0 deletions NKZSoft.Template.sln
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,18 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "infrastructure", "infrastru
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NKZSoft.Template.Presentation.Rest.Tests", "tests\NKZSoft.Template.Presentation.Rest.Tests\NKZSoft.Template.Presentation.Rest.Tests.csproj", "{AAE70EBF-D9D3-4864-9EE7-A8C13EDDBD16}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "ci-cd", "ci-cd", "{0D102F2F-EFC8-4A6E-ABF8-763AC136F57E}"
ProjectSection(SolutionItems) = preProject
.github\dependabot.yml = .github\dependabot.yml
.github\images\wizard.png = .github\images\wizard.png
.github\ISSUE_TEMPLATE\bug_report.md = .github\ISSUE_TEMPLATE\bug_report.md
.github\ISSUE_TEMPLATE\feature_request.md = .github\ISSUE_TEMPLATE\feature_request.md
.github\release-drafter.yml = .github\release-drafter.yml
.github\workflows\build-by-branch.yaml = .github\workflows\build-by-branch.yaml
.github\workflows\build-by-tag.yaml = .github\workflows\build-by-tag.yaml
.github\workflows\cleanup.yaml = .github\workflows\cleanup.yaml
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ dotnet new nkz-template -o My.NewApp1 --EnableGraphQL false --EnableGrpc false -
- [x] GraphQL API samples
- [x] MassTransit and RabbitMq
- [x] Minimal hosting model
- [x] Migrate to .NET 7
- [x] Migrate to .NET 8
- [x] HealthCheck
- [x] Websocket (SignalR)
- [x] GRPC Error handling in interceptors
Expand Down
1 change: 1 addition & 0 deletions deployment/docker/docker-compose-app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ services:
dockerfile: Dockerfile
environment:
ASPNETCORE_ENVIRONMENT: Docker
OTEL_DOTNET_EXPERIMENTAL_ASPNETCORE_ENABLE_GRPC_INSTRUMENTATION: 1
ports:
- "0.0.0.0:8080:8080"
- "0.0.0.0:8081:8081"
Expand Down
8 changes: 4 additions & 4 deletions deployment/docker/docker-compose-infrastructure.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ volumes:
services:

postgres:
image: postgres:14
image: postgres:16-alpine3.19
environment:
POSTGRES_PASSWORD: postgres
ports:
Expand All @@ -23,7 +23,7 @@ services:
retries: 15

rabbitmq:
image: rabbitmq:3.11-management
image: rabbitmq:3.4-management
environment:
RABBITMQ_DEFAULT_USER: rabbitmq
RABBITMQ_DEFAULT_PASS: rabbitmq
Expand All @@ -41,7 +41,7 @@ services:
retries: 15

redis:
image: redis:7.0
image: redis:7-alpine
ports:
- "0.0.0.0:6379:6379"
networks:
Expand All @@ -53,7 +53,7 @@ services:
retries: 15

jaeger:
image: jaegertracing/all-in-one:1.41
image: jaegertracing/all-in-one:1.55
environment:
- COLLECTOR_OTLP_ENABLED=true
- LOG_LEVEL=debug
Expand Down
4 changes: 2 additions & 2 deletions deployment/k8s/.helm/template-service/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 1.0.1
version: 1.0.2

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.12.0"
appVersion: "2.0.0"
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "7.0.0",
"version": "8.0.0",
"rollForward": "latestMajor",
"allowPrerelease": false
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ public async Task<TResponse> Handle(TRequest request, RequestHandlerDelegate<TRe
v.ValidateAsync(context, cancellationToken)));

var failures = validationResults
.Where(r => r.Errors.Any())
.Where(r => r.Errors.Count != 0)
.SelectMany(r => r.Errors)
.ToList();

if (failures.Any())
if (failures.Count != 0)
{
throw new ValidationException(failures);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,4 @@
namespace NKZSoft.Template.Application.Common.Exceptions;

[Serializable]
public sealed class AuthorizationException : Exception
{
public AuthorizationException(string message)
: base(message)
{
}

private AuthorizationException(SerializationInfo serializationInfo, StreamingContext streamingContext)
: base(serializationInfo, streamingContext)
{
}
}
public sealed class AuthorizationException(string message) : Exception(message);
Original file line number Diff line number Diff line change
@@ -1,15 +1,4 @@
namespace NKZSoft.Template.Application.Common.Exceptions;

[Serializable]
public sealed class BadRequestException : Exception
{
public BadRequestException(string message)
: base(message)
{
}

private BadRequestException(SerializationInfo serializationInfo, StreamingContext streamingContext)
: base(serializationInfo, streamingContext)
{
}
}
public sealed class BadRequestException(string message) : Exception(message);
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,4 @@ public ConflictException(string message)
: base(message)
{
}

private ConflictException(SerializationInfo serializationInfo, StreamingContext streamingContext)
: base(serializationInfo, streamingContext)
{
}
}
Loading

0 comments on commit a3630a3

Please sign in to comment.