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

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

问题描述

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

How to select all columns from tables in join using linq

数据库:

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

林克:

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.

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

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