Tell me more ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I have code to switch between databases when using EF, but now also need to allow the user to choose a particular table. (The tables all use the same schema but may have different names because of the way the client updates datasets). Is there a way to do this? And if it's done can it be done without being broken by updates being made to the Entity data model?

share|improve this question
This is very strange. Why not use views instead of different table names? – Emmad Kareem Sep 18 '12 at 5:59
@Emmad Kareem I know. I've asked that question and the answer had something to do with the way other applications generate datasets for various geographic areas. – Stonetip Sep 18 '12 at 14:13
Folks, please see note below in response to World Engineer's answer. I've decided we're just not going to pursue this avenue anyway. – Stonetip Sep 18 '12 at 14:14

1 Answer

This blog post goes into some detail. It's apparently fairly difficult.

share|improve this answer
1  
Link only answers are bad answers. While it may be difficult is there any information you can include in the answer? – ChrisF Sep 18 '12 at 12:58
@World Engineer Thanks for the link. I had come across that in my own research earlier. My thoughts were that it wasn't worth it. Incidentally, since some of our code base relies on ADO.NET and it supports async and await now (unlike EF), I've decided to just leave EF out of the project. – Stonetip Sep 18 '12 at 14:11
@Stonetip: Not using EF for this scenario was the best and IMHO the only correct solution for this case. You should post it as an answer to your question. – Ladislav Mrnka Sep 27 '12 at 7:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.