From 2897af25eba275abc075dbc7dbc8d649b5229a24 Mon Sep 17 00:00:00 2001 From: Vladimir Pecanac Date: Sun, 25 Oct 2026 13:28:05 +0100 Subject: [PATCH] Update DotnetEfNotFoundError sample to .NET 10 and EF Core 10 Retarget to net10.0, move EF Core packages to 10.0.13, pin System.Security.Cryptography.Pkcs 10.0.13 to clear NU1902/NU1903, make Customer match the article (settable properties, no constructor) so dotnet ef can build the model, and add a local tool manifest for dotnet-ef 10.0.13. --- .../CodeFirstMigration.csproj | 9 +++++---- .../CodeFirstMigration/Customer.cs | 20 +++++-------------- .../DotnetEfNotFoundError/dotnet-tools.json | 13 ++++++++++++ 3 files changed, 23 insertions(+), 19 deletions(-) create mode 100644 dotnet-efcore/DotnetEfNotFoundError/dotnet-tools.json diff --git a/dotnet-efcore/DotnetEfNotFoundError/CodeFirstMigration/CodeFirstMigration.csproj b/dotnet-efcore/DotnetEfNotFoundError/CodeFirstMigration/CodeFirstMigration.csproj index 9da450ed89..51ff7a1b39 100644 --- a/dotnet-efcore/DotnetEfNotFoundError/CodeFirstMigration/CodeFirstMigration.csproj +++ b/dotnet-efcore/DotnetEfNotFoundError/CodeFirstMigration/CodeFirstMigration.csproj @@ -2,18 +2,19 @@ Exe - net6.0 + net10.0 enable enable - - + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + + diff --git a/dotnet-efcore/DotnetEfNotFoundError/CodeFirstMigration/Customer.cs b/dotnet-efcore/DotnetEfNotFoundError/CodeFirstMigration/Customer.cs index f4b6278624..4a7297db6e 100644 --- a/dotnet-efcore/DotnetEfNotFoundError/CodeFirstMigration/Customer.cs +++ b/dotnet-efcore/DotnetEfNotFoundError/CodeFirstMigration/Customer.cs @@ -2,21 +2,11 @@ { public class Customer { - public Guid Id { get; } - public string? FirstName { get; } - public string? LastName { get; } + public Guid Id { get; set; } + public string? FirstName { get; set; } + public string? LastName { get; set; } public int Age { get; set; } - public string? Address { get; } - public string? CardNumber { get; } - - public Customer(Guid id, string? firstName, string? lastName, int age, string? address, string? cardNumber) - { - Id = id; - FirstName = firstName; - LastName = lastName; - Age = age; - Address = address; - CardNumber = cardNumber; - } + public string? Address { get; set; } + public string? CardNumber { get; set; } } } diff --git a/dotnet-efcore/DotnetEfNotFoundError/dotnet-tools.json b/dotnet-efcore/DotnetEfNotFoundError/dotnet-tools.json new file mode 100644 index 0000000000..39007e0217 --- /dev/null +++ b/dotnet-efcore/DotnetEfNotFoundError/dotnet-tools.json @@ -0,0 +1,13 @@ +{ + "version": 1, + "isRoot": true, + "tools": { + "dotnet-ef": { + "version": "10.0.13", + "commands": [ + "dotnet-ef" + ], + "rollForward": false + } + } +} \ No newline at end of file