From bcca3187707ce842e666e84ced390d71a3012bb7 Mon Sep 17 00:00:00 2001 From: Muhannad Al-Khatib Date: Sun, 11 Oct 2026 14:03:11 +0300 Subject: [PATCH] Move to .NET 10, EF Core 10 and CqApi 10 - net10.0 for the web app and SDK; aspnet:10.0 / sdk:10.0 images; CI on SDK 10.0.x with major version 10. - EF Core 10.0.12, Npgsql EF 10.0.3, EFCore.NamingConventions 10.0.1, EfCoreExtensions 10.0.1, JwtBearer 10.0.12. - CqApi 10.0.0, which maps handlers as endpoints: add MapCqApi(). It is built against HttpExtensions 8.1.1, so the SDK pins that exact version (the 8.0.0/8.1.0 mismatch is what broke every request on 2026-10-10), and needs FluentValidation 12.1.1. - Ignore PendingModelChangesWarning. short_url.created_on is timestamp without time zone in the database while the model maps DateTime to timestamptz; EF 8 ignored that, EF 9+ throws in Migrate(). Pinning the column type instead would make Npgsql reject the UTC CreatedOn the audit writes. SimplyWorks.Logger stays on 8.0.1, the latest published. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci-cd.yml | 4 ++-- Dockerfile | 4 ++-- SW.Surl.Sdk/SW.Surl.Sdk.csproj | 4 ++-- SW.Surl.Web/SW.Surl.Web.csproj | 16 ++++++++-------- SW.Surl.Web/Startup.cs | 7 +++++++ 5 files changed, 21 insertions(+), 14 deletions(-) diff --git a/.github/workflows/ci-cd.yml b/.github/workflows/ci-cd.yml index a62fb4c..3e52dfd 100644 --- a/.github/workflows/ci-cd.yml +++ b/.github/workflows/ci-cd.yml @@ -19,9 +19,9 @@ jobs: github.event_name == 'workflow_dispatch' }} uses: simplify9/.github/.github/workflows/reusable-service-cicd.yml@main with: - major-version: '8' + major-version: '10' minor-version: '0' - dotnet-version: '8.0.x' + dotnet-version: '10.0.x' # Build + push the SDK NuGet package (tests off, as before) nuget-projects: 'SW.Surl.Sdk/SW.Surl.Sdk.csproj' diff --git a/Dockerfile b/Dockerfile index f156c70..48ca949 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,11 @@ -FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base +FROM mcr.microsoft.com/dotnet/aspnet:10.0 AS base WORKDIR /app # .NET 8+ listens on 8080 by default; the surl Helm chart sends traffic to containerPort 80. ENV ASPNETCORE_HTTP_PORTS=80 EXPOSE 80 EXPOSE 443 -FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build +FROM mcr.microsoft.com/dotnet/sdk:10.0 AS build WORKDIR /src COPY ["SW.Surl.Web/SW.Surl.Web.csproj", "SW.Surl.Web/"] COPY ["SW.Surl.Sdk/SW.Surl.Sdk.csproj", "SW.Surl.Sdk/"] diff --git a/SW.Surl.Sdk/SW.Surl.Sdk.csproj b/SW.Surl.Sdk/SW.Surl.Sdk.csproj index ef05a3b..71bc335 100644 --- a/SW.Surl.Sdk/SW.Surl.Sdk.csproj +++ b/SW.Surl.Sdk/SW.Surl.Sdk.csproj @@ -1,7 +1,7 @@ - net8.0 + net10.0 SimplyWorks.Surl.Sdk SimplyWorks SimplyWorks.Surl.Sdk @@ -9,7 +9,7 @@ - + diff --git a/SW.Surl.Web/SW.Surl.Web.csproj b/SW.Surl.Web/SW.Surl.Web.csproj index 5f7d74c..ad4d826 100644 --- a/SW.Surl.Web/SW.Surl.Web.csproj +++ b/SW.Surl.Web/SW.Surl.Web.csproj @@ -1,6 +1,6 @@  - net8.0 + net10.0 @@ -8,16 +8,16 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - - + + + + + + diff --git a/SW.Surl.Web/Startup.cs b/SW.Surl.Web/Startup.cs index 063b6e5..7b857a6 100644 --- a/SW.Surl.Web/Startup.cs +++ b/SW.Surl.Web/Startup.cs @@ -2,6 +2,7 @@ using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Diagnostics; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; @@ -52,6 +53,11 @@ public void ConfigureServices(IServiceCollection services) services.AddDbContext(c => { c.EnableSensitiveDataLogging(true); + // created_on is timestamp without time zone in the database but the model maps DateTime + // to timestamptz (Npgsql 6+), which EF 8 ignored and EF 9+ reports as a pending change and + // throws on in Migrate(). Pinning the column type would make Npgsql refuse the UTC + // CreatedOn values the audit writes, so keep EF 8's behaviour. + c.ConfigureWarnings(w => w.Ignore(RelationalEventId.PendingModelChangesWarning)); c.UseSnakeCaseNamingConvention(); c.UseNpgsql(Configuration.GetConnectionString(SurlDbContext.ConnectionString), b => { @@ -79,6 +85,7 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) app.UseEndpoints(endpoints => { endpoints.MapControllers(); + endpoints.MapCqApi(); }); } }