Ability to define custom joins (for readonly navigations)
- Dominant language
- C#
- Stars
- 14.8k
- Forks
- 3.4k
- PR merge metrics
- PR metrics pending
Description
Not sure if it's currently possible, but would be nice to be able to define a "custom join" maybe.
Say we have a table `Metadata` and that table has PK Id and columns `RowId`, `TableName` and `Data`.
We also have tables `Blog` and `Post`.
In `RowId` we write down PK of the table with name in `TableName`. It would then be nice if we could explain to EF how to join from our tables `Blog` and `Post` to table `Metadata`.
If we have `List Metadatas` in `Blog`, we should be able to define in `ModelBuilder` that when we access `Blog.Metadatas` it would join by `Blog.Id = Metadata.RowId and Metadata.TableName = 'Blog'`.
I guess there is an issue with what happens if you want to add a `Metadata` entity to `Metadatas` list on `Blog` or `Post` 🤷
Contributor guide
Assessment
This issue has not been assessed yet.