【发布时间】:2012-11-22 07:41:24
【问题描述】:
我有 2 个数据库表。一种是主记录,另一种是使用字典结构的详细记录。
我想从详细信息表中查询一些字段,这些字段返回具有所有相同标题 ID 的多行。
有没有办法使用 linq 连接两个表来创建自定义记录
例子
主表: ID 主名 日期 ...
详细信息表 ID 主ID 钥匙 价值
伪代码: 来自 context.mastertable 中的 master 在 context.detailstable 中加入详细信息 在 master.ID == detail.masterID 选择新的自定义类{ ID = master.ID, 名称 = master.MasterName Customfield = (detailsvalue.where key == "customfield") + (detailvalue.where key == "customfield2") };
希望有人可以帮助我。
格茨·卢克·克里宁
【问题讨论】: