Skip to content
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
18 changes: 18 additions & 0 deletions Areas/Identity/Data/DesignTimeDbContextFactory.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Design;

namespace CarpentryShop.Areas.Identity.Data;

public class DesignTimeDbContextFactory : IDesignTimeDbContextFactory<CarpentryShopIdentityDbContext>
{
public CarpentryShopIdentityDbContext CreateDbContext(string[] args)
{
var connectionString = Environment.GetEnvironmentVariable("DB_CONNECTION")
?? throw new Exception("DB_CONNECTION environment variable is not set");

var optionsBuilder = new DbContextOptionsBuilder<CarpentryShopIdentityDbContext>();
optionsBuilder.UseNpgsql(connectionString);

return new CarpentryShopIdentityDbContext(optionsBuilder.Options);
}
}
22 changes: 11 additions & 11 deletions CarpentryShop.csproj
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<RuntimeIdentifier>linux-x64</RuntimeIdentifier> <!-- &lt;!&ndash; This line is the temp fix &ndash;&gt; -->
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
<AllowMissingPrunePackageData>true</AllowMissingPrunePackageData>
Comment on lines +3 to +6
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== Target frameworks =="
rg -nP --glob '*.csproj' '<TargetFramework>[^<]+</TargetFramework>|<TargetFrameworks>[^<]+</TargetFrameworks>'

echo "== global.json =="
fd -HI '^global\.json$' -x sh -c 'echo "--- {} ---"; cat "{}"'

echo "== CI dotnet setup =="
rg -n --glob '*.yml' --glob '*.yaml' 'setup-dotnet|dotnet-version|10\.0|net10\.0'

Repository: simanga-dev/carpentry-shop

Length of output: 203


🏁 Script executed:

# Check for direct Npgsql API usage
echo "== Searching for Npgsql usage in codebase =="
rg -n 'using Npgsql|Npgsql\.' --type cs -A 2

Repository: simanga-dev/carpentry-shop

Length of output: 999


🏁 Script executed:

# List all files to understand structure
echo "== Repository structure =="
git ls-files | head -20

Repository: simanga-dev/carpentry-shop

Length of output: 816


🏁 Script executed:

cat -n .github/workflows/dotnet.yml

Repository: simanga-dev/carpentry-shop

Length of output: 1528


🏁 Script executed:

cat -n Dockerfile

Repository: simanga-dev/carpentry-shop

Length of output: 605


Update CI and Docker SDK to .NET 10 to match target framework.

The project targets net10.0 but CI workflow and Dockerfile are pinned to SDK 8.0. Build and restore will fail:

  • .github/workflows/dotnet.yml line 20: change dotnet-version: 8.0.x10.0.x
  • Dockerfile line 3: change mcr.microsoft.com/dotnet/sdk:8.0mcr.microsoft.com/dotnet/sdk:10.0

Additionally, remove the explicit Npgsql package reference (line 23 in CarpentryShop.csproj) — the provider package brings it transitively and only EFCore metadata imports are used in the codebase. Mark dev-time tooling packages (Microsoft.EntityFrameworkCore.Tools, Microsoft.VisualStudio.Web.CodeGeneration.Design) as PrivateAssets="all" to prevent transitive dependency leakage.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@CarpentryShop.csproj` around lines 3 - 6, Update CI and container SDK
versions to match the project TargetFramework value net10.0: change the workflow
variable named dotnet-version from 8.0.x to 10.0.x and update the Docker base
image tag from mcr.microsoft.com/dotnet/sdk:8.0 to
mcr.microsoft.com/dotnet/sdk:10.0. In the project file remove the explicit
Npgsql PackageReference (the EF provider supplies it transitively) and mark the
tooling PackageReference entries for Microsoft.EntityFrameworkCore.Tools and
Microsoft.VisualStudio.Web.CodeGeneration.Design with PrivateAssets="all" so
they do not flow as transitive dependencies.

<UserSecretsId>aspnet-CarpentryShop-89BCD5B1-EB04-4F3F-87C0-6B750577E9DA</UserSecretsId>
</PropertyGroup>
<ItemGroup>
<None Update="app.db" CopyToOutputDirectory="PreserveNewest" ExcludeFromSingleFile="true" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="EntityFramework" Version="6.4.4" />
<PackageReference Include="MailKit" Version="3.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="8.0.11" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="8.0.11" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="8.0.11" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="9.0.0">
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="10.0.3" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="10.0.3" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="10.0.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="10.0.3">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="8.0.11" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="8.0.7" />
<PackageReference Include="Npgsql" Version="9.0.2" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="9.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="10.0.3" />
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="10.0.2" />
<PackageReference Include="Npgsql" Version="10.0.0" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="10.0.0" />
</ItemGroup>
</Project>
Loading
Loading