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

InvalidOperationException when mapping properties of different types to the same column #29859

Closed
AndriySvyryd opened this issue Dec 14, 2022 · 0 comments · Fixed by #29866
Closed
Labels
area-model-building closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. customer-reported regression Servicing-approved type-bug
Milestone

Comments

@AndriySvyryd
Copy link
Member

Class A: BaseClass

[Column(nameof(Configuration), TypeName = "jsonb")]
public ConfigurationForClassA Configuration { get; set; } = new();
Class B: BaseClass

[Column(nameof(Configuration), TypeName = "jsonb")]
public ConfigurationForClassB Configuration { get; set; } = new();
This worked in .NET 5&6 (with Ef Core 5/6) by re-using the column in the baseclass table. Breaks after upgrading to .NET 7 and EF7.

are both mapped to column 'Configuration' in 'BaseClassTable', but are configured to use differing provider types

I would assume that there is some conflict with the new json support in EF7, maybe there is some requirement to mark classes used in json columns in some way? e.g. with an [Owned] attribute?

Originally reported by @cm-andrews at npgsql/efcore.pg#2595

AndriySvyryd added a commit that referenced this issue Dec 15, 2022
… are used in a key, foreign key or a unique index

Fixes #29859
@AndriySvyryd AndriySvyryd added the closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. label Dec 15, 2022
AndriySvyryd added a commit that referenced this issue Dec 15, 2022
… are used in a key, foreign key or a unique index

Fixes #29859
AndriySvyryd added a commit that referenced this issue Dec 16, 2022
… are used in a key, foreign key or a unique index

Fixes #29859
@AndriySvyryd AndriySvyryd reopened this Dec 16, 2022
@ajcvickers ajcvickers added this to the 7.0.x milestone Dec 21, 2022
@ajcvickers ajcvickers modified the milestones: 7.0.x, 7.0.3 Dec 22, 2022
AndriySvyryd added a commit that referenced this issue Jan 4, 2023
… are used in a key, foreign key or a unique index

Fixes #29859
SonicGD added a commit to sitkoru/Sitko.Core that referenced this issue Jan 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-model-building closed-fixed The issue has been fixed and is/will be included in the release indicated by the issue milestone. customer-reported regression Servicing-approved type-bug
Projects
None yet
2 participants