Entity Framework map same table that exists in two databases

狂风中的少年 提交于 2019-12-24 13:18:59

问题


What options are available to correctly map the following using Entity Framework:

Database 1 tables: Foo, Foo_Assets, Assets

Database 2 tables: Bar, Bar_Assets, Assets

I have considered mapping Bar, Bar_Assets, Assets as SQL views, or using a different db context when loading these tables from Database 2. 

The challenge is that although Foo, Bar and their _Assets tables can be treated independently, both databases have an Assets table. How can these tables be correctly mapped to the Asset entity?


回答1:


Since you have 2 databases, you will have 2 edmx files. Just having a different name in the edmx for Assets table will work. This way you can ensure that there are no clashes.



来源:https://stackoverflow.com/questions/10248601/entity-framework-map-same-table-that-exists-in-two-databases

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!