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

Model "implicit" many-to-many scenarios via readonly navigations (no join table) #20337

Open
Tracked by #240 ...
roji opened this issue Mar 18, 2020 · 1 comment
Open
Tracked by #240 ...

Comments

@roji
Copy link
Member

roji commented Mar 18, 2020

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 :)

@ajcvickers ajcvickers added this to the Backlog milestone Mar 20, 2020
@AndriySvyryd AndriySvyryd changed the title Model "implicit" many-to-many scenarios via readonly navigations Model "implicit" many-to-many scenarios via readonly navigations (no join table) Oct 3, 2024
@AndriySvyryd
Copy link
Member

AndriySvyryd commented Oct 3, 2024

This can be implemented using #33171

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

3 participants