1

I have two student-data database with liked structure. Each database for one faculty and in another sql server instance. and db server1 link to db serer2, db server2 link to db server1. I want when user select a faculty , my program will connect to that database in and display it's data.

How can i do this with one entity model?

Andrew
  • 3,648
  • 1
  • 15
  • 29
Đức Anh
  • 11
  • 2
  • 1
    *Each database for one class* You might want to revisit that design. It sounds like multi-tenancy but instead of tenants you have classes (I assume these are school classes and you're not actually making a database for every `class`/entity). Database-per-tenant is a thing but then you end up with problems like this. – ta.speot.is Dec 22 '14 at 02:40
  • sorry,one database for one faculty. and each database in one sql server instance – Đức Anh Dec 22 '14 at 02:50
  • Why don't you use a separate connection string for each faculty? Anyway, you are trying to use the ORM as if it were an abstraction over SQL or the server, which it definitely is *not*. – Panagiotis Kanavos Dec 22 '14 at 07:43
  • I had about the same requirement as you have but I decided to go with one database and separate the data on the record level (multi-tenancy with EF filters as described [here](http://lostechies.com/jimmybogard/2014/05/29/missing-ef-feature-workarounds-filters/)) – jao Dec 22 '14 at 08:16

0 Answers0