-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Association of foreign keys between schemes or different databases #4595
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
Comments
+1 I hope this gets implemented if possible ;) |
Do you want to just be able to query between databases on the same server (or linked databases) - which can be handled by database-qualifying the table names on commands sent to the single database. Or, do you want EF to handle connections between multiple database, splitting up of the queries, etc. |
The idea is basically this. I really need execute this sql to create the foreign keys and constraints after creating my contexts using migrations, or exist other way? The microsoft have plans to implement this automation with migrations? Thanks |
Sounds like I misunderstood what you were asking for 😄. So you have several contexts that model different parts of your database and you want to be able to have FK relationships between those different parts of the model? If so, the current workaround is to have one large model that covers everything - used only for migrations - and then several smaller contexts that your app uses for data access. But we do want to be able to handle this more elegantly - see #2725. If I'm misunderstanding again, just let me know 😄. |
Perfect, you understood correctly, the issue #2725 is just that. :D I have a superficial idea, see, you can create a type of dependency between contexts, for example, you create a main context that will be executed by migrations, but this main context has dependencies with other contexts through foreign keys, then all you need is verify the integrity of these relationships, and publish only the main context, the other contexts will be used only to verify the integrity between the foreign keys. For example:
Thanks. :) |
Closing as we have the scenario covered by #2725 |
The migrations not support the association of foreign keys between schemes or different databases. Are there any plans to address this issue or it will never be implemented? For example, I have a security module and want to reuse it for other applications, specifically associate the user with a different game profiles. I really need this.
Best regards
The text was updated successfully, but these errors were encountered: