simon co
simon co

Reputation: 281

Entity Framework map same table that exists in two databases

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?

Upvotes: 1

Views: 2205

Answers (1)

Gautam Jain
Gautam Jain

Reputation: 6849

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.

Upvotes: 1

Related Questions