2

Is it possible to have an entity model created out of two databases, with all the relationships between tables reflected in the model? How do you do that?

I am referring to ADO.NET Entity Framework version 4.

1 Answer 1

5

Maybe. It depends on several factors.

If using a modern version of SQL Server, there is a feature called Synonyms, which allows you to "map" a table from one database into another.

Unfortunately, the EF Data designer doesn't recognize or understand Synonyms. There is a way to manually merge two .EDMX files into one, but this is a huge pain.

When using Synonyms, I prefer to use the Code First approach. I use the Entity Framework Power Tools extension to reverse engineer the tables to a code first model, and this works fine with synonyms.

If you want to use .EDMX, then you can try the approach here:

http://rachel53461.wordpress.com/2011/05/22/tricking-ef-to-span-multiple-databases/

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.