Skip to content

NET7: InvalidOperationException when mapping to the same jsonb column from different entities #2595

Description

@kev-andrews

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?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions