选择联接+ linq联接中所有表的所有列 [英] Select All columns for all tables in join + linq join

查看:65
本文介绍了选择联接+ linq联接中所有表的所有列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何使用linq从联接表中选择所有列

How to select all columns from tables in join using linq

Sql:

select CTRL_RUN_JOB.*, CTRL_DATA_STREAM.*
 from CTRL_RUN_JOB inner join CTRL_DATA_STREAM
      on CTRL_RUN_JOB.DATA_STREAM_ID= CTRL_DATA_STREAM.DATA_STREAM_ID

Linq:

from CTLJCRJOB in CTRL_RUN_JOBs 
join CTLRFDSTM in CTRL_DATA_STREAMs 
on CTLJCRJOB.DATA_STREAM_ID equals CTLRFDSTM.DATA_STREAM_ID
select  new {
         CTLJCRJOB.*  // ???
        ,CTLRFDSTM.*  // ???
}

谢谢

推荐答案

虽然无法将它们扩展为列,但是您可以简单地返回实体.例如:

While you cant expand them to columns, you can simply return the entities. Eg:

select new { CTLJCRJOB, CTLRFDSTM }

如果需要将其展平,则必须自己写出映射,但是仍然非常琐碎.

If you need it flattened, then you will have to write out the mapping yourself, but will still be very trivial.

这篇关于选择联接+ linq联接中所有表的所有列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆