0

I did not see a resolution to this post so I thought I would ask this again using a tutorial as an example. I looked into this in EF4 and due to the limits I gave up. Now with EF6 I'm wondering if you can reference multiple databases or not.

For example, if you look at the Contonso University tutorial from Tom D you see a simple app using a single DB. What if all the people related data was contained in a separate DB. This would be the models like Person, Student, and Instructor which use the Person physical table. Can that be moved to a separate DB and have all the other functionality work without something like synonyms?

In a real world example we have separate databases for employee data and project data. We have an application for employee related information which can use just the employee DB with no problem. But you cannot build a project app without referencing the employee DB (to track who is working on what project). Ideally I want to build the employee app with EF and then turn around and leverage all that work with the project app. Then move on to a billing app which has another separate DB but would refer to both employee and project DBs.

I think the answer is "no" and this still can't be done but I want to get clarification.

Community
  • 1
  • 1
pretzelb
  • 1,131
  • 2
  • 16
  • 38
  • I asked the EF team at MS about this and the response I got was that the best practice for an application with multiple databases is to use views or synonyms to bring all the objects into a single database and point the application at that database. Is that feasible in your environment? – tdykstra Mar 28 '14 at 01:24
  • Synonyms are not a viable option for us. Views are possible I think but my guess is the performance would suffer. Just planning this in my head, wouldn't that mean you could not re-use objects or class libraries created in the source DB? Ideally I'd like to create all the DAL objects in a project for say the employee DB, and then re-use that same project as a reference in another project using a different DB. I am not sure if that would work. I would need to try a demo. – pretzelb Apr 01 '14 at 20:05

0 Answers0