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

Support mapping multiple owned types to the same JSON column (sharing) #28592

Open
Tracked by #22953
AndriySvyryd opened this issue Aug 4, 2022 · 8 comments
Open
Tracked by #22953

Comments

@AndriySvyryd
Copy link
Member

No description provided.

@ajcvickers
Copy link
Member

This is not easy, but would enable some interesting and useful scenarios--see #29456.

@codelovercc
Copy link

@ajcvickers Hi, I am so excited about this feature. Any news? Will this be supported in Entity Framework Core 8 (EF Core 8; EF8) ?

@ajcvickers
Copy link
Member

This issue is in the Backlog milestone. This means that it is not planned for the next release (EF Core 8.0). We will re-assess the backlog following the this release and consider this item at that time. However, keep in mind that there are many other high priority features with which it will be competing for resources. Make sure to vote (👍) for this issue if it is important to you.

@joakimriedel
Copy link
Contributor

Please keep on voting for this issue so it might get prioritized for v9! 👍

With TPH this would make for a very powerful storage of metadata for similar, yet different, entities. Now the database would get flooded with columns like MetadataJsonA, MetadataJsonB, MetadataJsonC for each entity in the hierarchy. Once this gets implemented however, I imagine it will be easy to consolidate all columns to a single MetadataJson column.

@uabarahona
Copy link

uabarahona commented May 24, 2024

Keep voting people, this is definitely an important feature that actually opens many uses cases for json columns, does anyone know if there is a workaround?

@digitalsigi
Copy link

This would be an exiting thing! I a certain project we store audit data of other Tables in auditlog table as json string and in another column we store the table name. One for old valua one for new new value. The json string is generated is overriden SaveChanges methode, This works very very well and allows to even display the changed values.

However, reading this column back into object is currently painful and requires a rather long if / else sequence to create the typed object.

Hopefully there will be a more general solution to this.

@elementh
Copy link

This would be game changing, honestly!

@roji
Copy link
Member

roji commented Aug 17, 2024

Note #27779, which is also about mapping multiple types to the same JSON document (or sub-document), but where the types are in a hierarchy - also via the use of a discriminator ($type). We may want to implement these two features together.

Note also that we already allow mapping unrelated entity types to the same container in Cosmos with a discriminator property (but not sub-documents).

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

No branches or pull requests

9 participants