Click here to Skip to main content
15,885,777 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
Don't ask why but I have multiple tables with the same schema (existing database, I can't change this). Then I want select in comboBox or listBox the table and then get data.
Table01
Table02
Table03

C++
var result = context.Table01.Select(p => p);


Can I somehow replace Table01 with Table02 to not make multiple queries depends on comboBox selection?
Posted
Comments
DiponRoy 28-Aug-14 13:14pm    
1. Entity Framework code first / database first ?
2. Are you trying to apply same query to same schema tables ?
Marcin1199 1-Sep-14 5:12am    
1. Database first. I cannot change database schema.
2. I don't how apply query to different table but with the same structure.

What you are trying might not be easy if not impossible. Because for entity framework, 2 different entities(and so 2 different tables) are 2 different things and are not replaceable. And why do you even want to replace it. Just to write less code ?
 
Share this answer
 
IF you will have 70 databases, and inside this databases you will have multiple tables you probably ask also about possibility :)

I used to use simple command, reader and I could change table or database in query. But right now because of stupidity of database creator I have a lot of work. If I want to change something in linq query I have to change this in all queries.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900