Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[release/8.0] Don't generate a discriminator in the snapshot if there's no discriminator property. #33622

Merged
merged 1 commit into from May 1, 2024

Conversation

AndriySvyryd
Copy link
Member

@AndriySvyryd AndriySvyryd commented Apr 27, 2024

Fixes #33605

Description
When an entity type is discovered as part of a TPH inheritance it gets a discriminator value assigned. If the base type is ignored later and a migration is generated EF preserves the discriminator value even though the is no corresponding discriminator property.

Customer impact
When adding another migration in the above scenario EF will generate an operation to drop the non-existing discriminator column, resulting in an error. A workaround is to manually edit the snapshot or the migration, but this would need to be done after every new migration.
While there has only been one report this affects models with an abstract unmapped base type, which is not that uncommon.

How found
Customer reported on 8.

Regression
Yes, from 7

Testing
Test added.

Risk
Low. The fix is in code that only runs as part of a design-time tool.

@AndriySvyryd AndriySvyryd requested a review from a team April 27, 2024 05:43
@SamMonoRT SamMonoRT added this to the 8.0.x milestone Apr 30, 2024
@SamMonoRT
Copy link
Member

Approved in email.
cc @maumar

@SamMonoRT SamMonoRT modified the milestones: 8.0.x, 8.0.6 Apr 30, 2024
@maumar maumar merged commit d6e69a0 into release/8.0 May 1, 2024
7 checks passed
@maumar maumar deleted the Issue33605 branch May 1, 2024 22:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants