Unique constraints in EF Core: retarget net10.0, EF Core 10, built-in OpenAPI - #2209
Merged
Conversation
… OpenAPI Retarget both projects from net8.0 to net10.0. Packages: EF Core and EF Core SqlServer 8.0.2 to 10.0.12, AspNetCore.OpenApi 8.0.2 to 10.0.12, Mvc.Testing 8.0.2 to 10.0.12, Test.Sdk 17.8.0 to 18.10.1, xunit 2.5.3 to 2.9.3, xunit.runner.visualstudio 2.5.3 to 4.0.0, coverlet 6.0.0 to 10.0.1, Testcontainers.MsSql 3.7.0 to 4.15.0, FluentAssertions 6.12.0 to 7.2.2. Removed Swashbuckle.AspNetCore (replaced by AddOpenApi and MapOpenApi) and EntityFrameworkCore.InMemory (referenced by no source file). Code: - Planet gains OrbitalPeriod, which the article's composite index examples use. - Program.cs: AddOpenApi/MapOpenApi in place of Swagger; Add instead of AddAsync (the async form exists for value generators that hit the database); catch (DbUpdateException) instead of a bare catch, which is the exception a unique index violation arrives as; .WithOpenApi() dropped, deprecated on .NET 10 (ASPDEPR002). - SolarSystemApiApplicationFactory: MsSqlBuilder takes the image parameter, the parameterless constructor is obsolete on Testcontainers 4.x (CS0618). - Connection string: Database=SolarSystem instead of Database=Master, so the sample stops creating its tables in the server's master database. - Both live tests set OrbitalPeriod, now a required member. Build: 0 errors, 0 warnings on SDK 10.0.302. Repo CI runs no tests in this folder, its filter excludes every Live-named test.
…a-property-code-first
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Unique constraints in EF Core: retarget to net10.0 and modernise the sample.
Both projects move from net8.0 to net10.0.
Package versions re-queried from the NuGet flat-container index on 2026-09-15 and shipped as read that day:
FluentAssertions stays on the 7.x line, which is still Apache-2.0. 7.2.2 needed no assertion edit here, so the fallback pin to 6.12.2 was not taken.
InMemory is removed because no source file in either project references it. Swashbuckle is replaced by the built-in document: AddOpenApi() and MapOpenApi().
Code changes:
Verification on this machine, SDK 10.0.302 with runtime 10.0.10: dotnet build -c Release gives 0 errors and 0 warnings.
Note on CI for this folder: the workflow runs the solution with --filter "FullyQualifiedName!~Live", and AddPlanetEndpointLiveTests is the only test class here, so CI runs zero tests and a green check proves the build only. Test discovery was checked separately so a silent zero is not mistaken for a pass: dotnet test --list-tests reports both tests on xunit 2.9.3 with runner 4.0.0. The two tests themselves need Docker and have not been executed on this machine; they are owed a run on a machine with Docker before this merges.