Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to .NET 9 #168

Merged
merged 7 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ jobs:
ports:
- "9200:9200"
steps:
- name: Set up .NET 9
uses: actions/setup-dotnet@v3
with:
dotnet-version: '9.0.x'
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
Expand All @@ -45,10 +49,10 @@ jobs:
fetch-depth: 0
- name: Install SonarCloud scanner
run: |
dotnet tool install --global dotnet-sonarscanner --version 6.1.0
dotnet tool install --global dotnet-sonarscanner --version 9.0.2
- name: Install EF Core Tools
run: |
dotnet tool install --global dotnet-ef --version 8.0.10
dotnet tool install --global dotnet-ef --version 9.0.0
- name: Build and test
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .template-config/template.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "http://json.schemastore.org/template",
"author": "Vanderlan Gomes",
"name": "Orion API Project Template",
"description": "A complete project template for creating a .NET 8 Web API",
"description": "A complete project template for creating a .NET 9 Web API",
"classifications": [ "WebApi" ],
"identity": "Orion.Api.Project.Template",
"shortName": "orion-api",
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build-env
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build-env
WORKDIR /app

COPY . ./

RUN dotnet restore "src/Company.Orion.Api/Company.Orion.Api.csproj"
RUN dotnet publish "src/Company.Orion.Api/Company.Orion.Api.csproj" -c Release -o out

FROM mcr.microsoft.com/dotnet/aspnet:8.0
FROM mcr.microsoft.com/dotnet/aspnet:9.0

ENV ASPNETCORE_ENVIRONMENT=Production
ENV ASPNETCORE_URLS=http://+:80
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

**About this Project**

*A simple project template for creating a .NET Web Api (v8.0)*
*A simple project template for creating a .NET Web Api (v9.0)*

The main objective is to start projects with a clean and simple architecture, without having to redo the entire configuration whenever starting a new project with similar characteristics.

Expand Down
22 changes: 11 additions & 11 deletions src/Company.Orion.Api/Company.Orion.Api.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Web">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<UserSecretsId>7401dc57-e892-498d-a628-03091ec95c6a</UserSecretsId>
<ImplicitUsings>enable</ImplicitUsings>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
Expand All @@ -10,36 +10,36 @@

<ItemGroup>
<!--#if (systemDatabase == SqlServer) -->
<PackageReference Include="AspNetCore.HealthChecks.SqlServer" Version="8.0.2" />
<PackageReference Include="AspNetCore.HealthChecks.SqlServer" Version="9.0.0" />
<!-- #else -->
<PackageReference Include="AspNetCore.HealthChecks.NpgSql" Version="8.0.2" />
<PackageReference Include="AspNetCore.HealthChecks.NpgSql" Version="9.0.0" />
<!-- #endif -->
<PackageReference Include="Asp.Versioning.Mvc" Version="8.1.0" />
<PackageReference Include="AspNetCore.HealthChecks.Elasticsearch" Version="8.0.1" />
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="8.0.1" />
<PackageReference Include="AspNetCore.HealthChecks.Elasticsearch" Version="9.0.0" />
<PackageReference Include="AspNetCore.HealthChecks.UI.Client" Version="9.0.0" />
<PackageReference Include="Elastic.Serilog.Sinks" Version="8.12.3" />
<PackageReference Include="FluentValidation" Version="11.11.0" />
<PackageReference Include="FluentValidation.AspNetCore" Version="11.3.0" />
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.10">
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="9.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<TreatAsUsed>true</TreatAsUsed>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.1">
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.0">
<TreatAsUsed>true</TreatAsUsed>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.2">
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.0">
<TreatAsUsed>true</TreatAsUsed>
</PackageReference>
<PackageReference Include="Serilog.AspNetCore" Version="8.0.3" />
<PackageReference Include="Serilog.AspNetCore" Version="9.0.0" />
<PackageReference Include="Serilog.Enrichers.CorrelationId" Version="3.0.1" />
<PackageReference Include="Serilog.Enrichers.Environment" Version="3.0.1" />
<PackageReference Include="Serilog.Sinks.Debug" Version="3.0.0">
<TreatAsUsed>true</TreatAsUsed>
</PackageReference>
<PackageReference Include="Swashbuckle.AspNetCore" Version="7.2.0" />
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="6.9.0" />
<PackageReference Include="Swashbuckle.AspNetCore.Annotations" Version="7.2.0" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Company.Orion.Api/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@

app.RunMigrations();

await app.RunAsync();
await app.RunAsync();
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>

Expand All @@ -11,8 +11,8 @@

<ItemGroup>
<PackageReference Include="FluentValidation" Version="11.11.0" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="8.0.1" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.2" />
<PackageReference Include="Microsoft.Extensions.Logging" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand All @@ -10,7 +10,7 @@

<ItemGroup>
<PackageReference Include="MediatR" Version="12.4.1" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.2.1" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.3.0" />
</ItemGroup>

<ItemGroup>
Expand Down
8 changes: 8 additions & 0 deletions src/Company.Orion.Domain.Core/Entities/Customer.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace Company.Orion.Domain.Core.Entities
{
public class Customer : BaseEntity
{
public long CustomerId { get; set; }
public required string Name { get; set; }
}
}
14 changes: 9 additions & 5 deletions src/Company.Orion.Infra.Data/Company.Orion.Infra.Data.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand All @@ -12,12 +12,12 @@

<ItemGroup>
<!--#if (systemDatabase == SqlServer) -->
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="9.0.0" />
<!-- #else -->
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.10" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.2" />
<!-- #endif -->
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="8.0.10" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.10">
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="9.0.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="9.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<TreatAsUsed>true</TreatAsUsed>
Expand All @@ -28,4 +28,8 @@
<ProjectReference Include="..\Company.Orion.Domain.Core\Company.Orion.Domain.Core.csproj" />
</ItemGroup>

<ItemGroup>
<Folder Include="Migrations\" />
</ItemGroup>

</Project>
9 changes: 5 additions & 4 deletions src/Company.Orion.Infra.Data/Mapping/UserMapping.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using Company.Orion.Domain.Core.Entities.Enuns;
using Company.Orion.Domain.Core.Entities;
using Company.Orion.Domain.Core.Extensions;
using System.Globalization;

namespace Company.Orion.Infra.Data.Mapping;

Expand All @@ -22,12 +23,12 @@ public void Configure(EntityTypeBuilder<User> builder)
builder.HasData(
new User
{
UserId = DateTime.UtcNow.Ticks,
PublicId = Guid.NewGuid().ToString(),
CreatedAt = DateTime.UtcNow,
UserId = 923165498765432123,
PublicId = "16537902-1ca7-49ca-82e5-0be137f9aeeb",
CreatedAt = DateTime.Parse("2025-01-01", new CultureInfo("en-US")),
Email = "adm@orion.com",
Name = "Orion Admin User",
LastUpdated = DateTime.UtcNow,
LastUpdated = DateTime.Parse("2025-01-01", new CultureInfo("en-US")),
Profile = UserProfile.Admin,
Password = "123".ToSha512()
}
Expand Down
Loading
Loading