Change DbContext connection at run-time

c# database entity entity-framework reflection

Question

I want to collaborate with DBs A, B, and C. Everybody uses the same tables (for example: users, products).

I want to leave it up to the user to select the database he wishes to use (at runtime). Therefore, I generated the ADBEntities, BDBEntities, and CDBEntities classes using EF5 and three edbx files.

How can I allow him to select the database so that I can access its users?

I mean,

var dstuff = from user in selecteddb.users
             where user.UserEmail == userEmail
             select user.UserID;

Reflection and base classes (DBEntities) have crossed my mind, but I never really pursued those concepts.

1
5
11/27/2013 10:28:00 PM

Accepted Answer

ZZZ_tmp
14
11/27/2013 10:20:13 PM

Popular Answer

ZZZ_tmp


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow