linq mysql 多表,从数据库获取所有表,并使用C#,linq查询和实体框架工作循环遍历每个表...

I have sql server 2012 database with 12 tables (excluding look up tables). i am using entity frame work and trying to query. i am able to query a table:ClientEntities dc = new ClientEntities();

var query = from client1 in dc.CLIENTTable

where client1.CLIENT_ID == txtId.Text

select client1;

above works for 1 table but i need to do it for all the 12 tables. Is there a way to do it in loop

解决方案

Yes, if your other tables have keys that link them together, you can do it. Otherwise, you need to read them separately. You need to explain why you want to do this, and what you''re trying to achieve. As it stands, it makes no sense at all.

You realise that you''ll have to define your own type that contains the combined data ? You can''t read the data from one table and store it in a type from another table, EF is all strongly typed. You can use var to create an anonymous type, of course.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值