Skip to content

Commit 557dfb2

Browse files
committed
Upgrade .NET SDK and dependencies to version 10.0; update PostgreSQL image to 17-alpine and add pgAdmin service to docker-compose.
1 parent 1c9c39b commit 557dfb2

File tree

11 files changed

+64
-62
lines changed

11 files changed

+64
-62
lines changed

Dockerfile.api

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base
1+
FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS base
22
WORKDIR /app
33
EXPOSE 8000
44
ENV ASPNETCORE_URLS=http://+:8000
@@ -7,7 +7,7 @@ RUN groupadd -g 2000 dotnet \
77
USER dotnet
88

99
# This stage is used to build the service project
10-
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
10+
FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build
1111
ARG BUILD_CONFIGURATION=Release
1212
ARG DOTNET_SKIP_POLICY_LOADING=true
1313
WORKDIR /src

aspire/AppHost/Contact.AppHost.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<PropertyGroup>
66
<OutputType>Exe</OutputType>
7-
<TargetFramework>net9.0</TargetFramework>
7+
<TargetFramework>net10.0</TargetFramework>
88
<ImplicitUsings>enable</ImplicitUsings>
99
<Nullable>enable</Nullable>
1010
<UserSecretsId>bb5b77e4-f73c-4004-b644-1baad7c5156e</UserSecretsId>
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net9.0</TargetFramework>
4+
<TargetFramework>net10.0</TargetFramework>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77
<IsAspireSharedProject>true</IsAspireSharedProject>
@@ -10,13 +10,13 @@
1010
<ItemGroup>
1111
<FrameworkReference Include="Microsoft.AspNetCore.App" />
1212

13-
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="9.9.0" />
14-
<PackageReference Include="Microsoft.Extensions.ServiceDiscovery" Version="9.5.0" />
15-
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.12.0" />
16-
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.12.0" />
17-
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.12.0" />
18-
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.12.0" />
19-
<PackageReference Include="OpenTelemetry.Instrumentation.Runtime" Version="1.12.0" />
13+
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="10.0.0" />
14+
<PackageReference Include="Microsoft.Extensions.ServiceDiscovery" Version="10.0.0" />
15+
<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.14.0" />
16+
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.14.0" />
17+
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.14.0" />
18+
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.14.0" />
19+
<PackageReference Include="OpenTelemetry.Instrumentation.Runtime" Version="1.14.0" />
2020
</ItemGroup>
2121

2222
</Project>

backend/Contact.Api/Contact.Api.csproj

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22

33
<PropertyGroup>
4-
<TargetFramework>net9.0</TargetFramework>
4+
<TargetFramework>net10.0</TargetFramework>
55
<Nullable>enable</Nullable>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<UserSecretsId>49b39230-4f26-4ba3-94cd-9738b4b66435</UserSecretsId>
88
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
9+
<OpenApiGenerateDocuments>true</OpenApiGenerateDocuments>
910
</PropertyGroup>
1011

1112
<ItemGroup>
12-
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.21.2" />
13-
<PackageReference Include="Swashbuckle.AspNetCore" Version="8.1.1" />
13+
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="10.0.0" />
14+
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.22.1" />
15+
<PackageReference Include="Scalar.AspNetCore" Version="2.1.10" />
1416
</ItemGroup>
1517

1618
<ItemGroup>

backend/Contact.Api/Program.cs

Lines changed: 17 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using Microsoft.AspNetCore.Authentication.JwtBearer;
66
using Microsoft.AspNetCore.Authorization;
77
using Microsoft.IdentityModel.Tokens;
8+
using Scalar.AspNetCore;
89
using System.Text;
910

1011

@@ -32,40 +33,15 @@
3233
ValidAudience = appSettings.Audience,
3334
IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(appSettings.Secret))
3435
};
35-
//options.Events = new JwtBearerEvents()
36-
//{
37-
// OnAuthenticationFailed = c =>
38-
// {
39-
// c.NoResult();
40-
// c.Response.StatusCode = 500;
41-
// c.Response.ContentType = "text/plain";
42-
// return c.Response.WriteAsync(c.Exception.ToString());
43-
// },
44-
// OnChallenge = context =>
45-
// {
46-
// context.HandleResponse();
47-
// context.Response.StatusCode = 401;
48-
// context.Response.ContentType = "application/json";
49-
// var result = JsonSerializer.Serialize(new { Message = "You are not Authorized" });
50-
// return context.Response.WriteAsync(result);
51-
// },
52-
// OnForbidden = context =>
53-
// {
54-
// context.Response.StatusCode = 403;
55-
// context.Response.ContentType = "application/json";
56-
// var result = JsonSerializer.Serialize(new { Message = "You are not authorized to access this resource" });
57-
// return context.Response.WriteAsync(result);
58-
// },
59-
//};
6036
});
6137

6238
builder.Services.AddSingleton<IAuthorizationPolicyProvider, CustomAuthorizationPolicyProvider>();
6339
builder.Services.AddScoped<IAuthorizationHandler, PermissionHandler>();
6440

6541
builder.Services.AddControllers();
66-
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
67-
builder.Services.AddEndpointsApiExplorer();
68-
builder.Services.AddSwaggerGen();
42+
43+
// Configure OpenAPI
44+
builder.Services.AddOpenApi();
6945

7046
var app = builder.Build();
7147

@@ -74,9 +50,20 @@
7450
// Configure the HTTP request pipeline.
7551
if (app.Environment.IsDevelopment())
7652
{
77-
app.UseSwagger();
78-
app.UseSwaggerUI();
53+
app.MapOpenApi();
54+
app.MapScalarApiReference(options =>
55+
{
56+
options.WithTitle("Contact API")
57+
.WithTheme(ScalarTheme.BluePlanet)
58+
.WithDefaultHttpClient(ScalarTarget.CSharp, ScalarClient.HttpClient)
59+
.WithPreferredScheme("Bearer")
60+
.WithHttpBearerAuthentication(bearer =>
61+
{
62+
bearer.Token = "";
63+
});
64+
});
7965
}
66+
8067
app.UseMiddleware<ExceptionMiddleware>();
8168
app.UseMiddleware<ActivityLoggingMiddleware>();
8269
app.UseHttpsRedirection();

backend/Contact.Api/Properties/launchSettings.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"http": {
44
"commandName": "Project",
55
"launchBrowser": true,
6-
"launchUrl": "swagger",
6+
"launchUrl": "scalar/v1",
77
"environmentVariables": {
88
"ASPNETCORE_ENVIRONMENT": "Development"
99
},
@@ -13,7 +13,7 @@
1313
"https": {
1414
"commandName": "Project",
1515
"launchBrowser": true,
16-
"launchUrl": "swagger",
16+
"launchUrl": "scalar/v1",
1717
"environmentVariables": {
1818
"ASPNETCORE_ENVIRONMENT": "Development"
1919
},
@@ -23,15 +23,15 @@
2323
"IIS Express": {
2424
"commandName": "IISExpress",
2525
"launchBrowser": true,
26-
"launchUrl": "swagger",
26+
"launchUrl": "scalar/v1",
2727
"environmentVariables": {
2828
"ASPNETCORE_ENVIRONMENT": "Development"
2929
}
3030
},
3131
"Container (Dockerfile)": {
3232
"commandName": "Docker",
3333
"launchBrowser": true,
34-
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger",
34+
"launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/scalar/v1",
3535
"environmentVariables": {
3636
"ASPNETCORE_HTTPS_PORTS": "8081",
3737
"ASPNETCORE_HTTP_PORTS": "8080"

backend/Contact.Application/Contact.Application.csproj

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net9.0</TargetFramework>
4+
<TargetFramework>net10.0</TargetFramework>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="AutoMapper" Version="14.0.0" />
11-
<PackageReference Include="FluentValidation.AspNetCore" Version="11.3.0" />
12-
<PackageReference Include="Microsoft.IdentityModel.Tokens" Version="8.8.0" />
13-
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.8.0" />
10+
<PackageReference Include="AutoMapper" Version="15.1.0" />
11+
<PackageReference Include="FluentValidation.AspNetCore" Version="11.3.1" />
12+
<PackageReference Include="Microsoft.IdentityModel.Tokens" Version="8.15.0" />
13+
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.15.0" />
1414
</ItemGroup>
1515

1616
<ItemGroup>

backend/Contact.Common/Contact.Common.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net9.0</TargetFramework>
4+
<TargetFramework>net10.0</TargetFramework>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77
</PropertyGroup>

backend/Contact.Domain/Contact.Domain.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net9.0</TargetFramework>
4+
<TargetFramework>net10.0</TargetFramework>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77
</PropertyGroup>

backend/Contact.Infrastructure/Contact.Infrastructure.csproj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFramework>net9.0</TargetFramework>
4+
<TargetFramework>net10.0</TargetFramework>
55
<ImplicitUsings>enable</ImplicitUsings>
66
<Nullable>enable</Nullable>
77
</PropertyGroup>
@@ -13,11 +13,11 @@
1313

1414
<ItemGroup>
1515
<PackageReference Include="Dapper" Version="2.1.66" />
16-
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="9.0.4" />
17-
<PackageReference Include="Npgsql" Version="9.0.3" />
18-
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="9.0.4" />
19-
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.4" />
20-
<PackageReference Include="Microsoft.Extensions.Options" Version="9.0.4" />
16+
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="10.0.0" />
17+
<PackageReference Include="Npgsql" Version="10.0.0" />
18+
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="10.0.0" />
19+
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.0" />
20+
<PackageReference Include="Microsoft.Extensions.Options" Version="10.0.0" />
2121
</ItemGroup>
2222

2323
<ItemGroup>

0 commit comments

Comments
 (0)