Model "implicit" many-to-many scenarios via readonly navigations (no join table)
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 35/100
Research direction
The issue names no files, tests, or entry points. Start by tracing EF Core's relationship and navigation modeling, then determine the design needed for a read-only many-to-many navigation whose join is inferred from matching postal-code columns; done means the scenario can be modeled and queried without a join table while remaining non-mutable.
Written by the indexing model from the issue text.
Description
In a real-world project, I encountered the following scenario:
- There's a Patient entity which has a postal code.
- There's a HealthAuthority entity, which also has a postal code and some other details.
- There are multiple postal codes per health authority, because a district spans several postal codes (this is not a problem).
- But there are also multiple health authorities per postal code, since postal codes and administrative districts don't overlap.
- As a user, it would be great to have a collection navigation from Patient to all of their HealthAuthorities, which would simply produce a join on the postal code column in the HealthAuthority table.
- However, as @AndriySvyryd pointed out offline, we can't mutate such a navigation - the relationship between Patients and HealthAuthorities isn't determined on an explicit, one-by-one basis via a join table (which can be skipped), but rather by an "implicit" connection (a Patient is related to a HealthAuthority if their postal codes correspond).
- We could still allow modelling this as a read-only navigation. The user would mutate by modifying the HealthAuthority table directly etc.
/cc @Brar
PS Should leave customer-reported :)
- Dominant language
- C#
- Stars
- 14.8k
- Forks
- 3.4k
- Avg merge
- 2d 5h
- Merged PRs (30d)
- 134
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from dotnet/efcore
-
Difficulty 4/5 3-5 days Newbie friendliness 55/100
-
customer-reported
Difficulty 5/5 Over a week Newbie friendliness 38/100
-
area-cosmos area-vector-search
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
area-cosmos
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
area-tools needs-design
Difficulty 4/5 3-5 days Newbie friendliness 25/100
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
-
:watch: Not Triaged 11.0 fundamentals/subsvc
Difficulty 2/5 1-3 hours Newbie friendliness 92/100
dotnet/AspNetCore.Docs#37699 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
SubtitleEdit/subtitleedit#15108 · 1 comment ·
-
area/docs-content Bug pulumi/docs
Difficulty 1/5 1-3 hours Newbie friendliness 94/100
-
agentic-workflows untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 76/100