Fix shared type entity type name generattion in model snapshot#38611
Open
AndriySvyryd wants to merge 1 commit into
Open
Fix shared type entity type name generattion in model snapshot#38611AndriySvyryd wants to merge 1 commit into
AndriySvyryd wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes snapshot generation for owned entity types with shared CLR types so that regenerating a model snapshot from a model that was itself built from a snapshot (e.g., during Remove-Migration) doesn’t produce corrupted owned type names in HasForeignKey(...) calls (Issue #36180).
Changes:
- Adjust
CSharpSnapshotGenerator.GetFullNameto better normalize owned entity type names whenHasSharedClrTypeis true (including handling names derived fromShortName()). - Add a regression test covering an owned collection containing a one-to-one reference, verifying snapshot round-tripping stability and successful compilation.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| test/EFCore.Design.Tests/Migrations/Design/CSharpMigrationsGeneratorTest.ModelSnapshot.cs | Adds a regression test to ensure snapshot regeneration doesn’t corrupt owned type names for one-to-one relationships inside owned collections. |
| src/EFCore.Design/Migrations/Design/CSharpSnapshotGenerator.cs | Updates owned entity type name normalization logic for shared CLR types to prevent duplicated/incorrect owned type names in generated snapshots. |
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.
Fixes #36180