【发布时间】:2012-03-05 14:43:10
【问题描述】:
在 SQL 中我有:
SELECT gu.*, cu.*
FROM [gene_genunit] as gu, [cont_unitati] as cu
WHERE gu.COD_UNIT = cu.COD_UNIT
我有一个 WPF 应用程序。
【问题讨论】:
在 SQL 中我有:
SELECT gu.*, cu.*
FROM [gene_genunit] as gu, [cont_unitati] as cu
WHERE gu.COD_UNIT = cu.COD_UNIT
我有一个 WPF 应用程序。
【问题讨论】:
LINQ 等效项是
from gu in context.Gene
join cu in Context.Cont
on gu.Code_Unit equals cu.Code_Unit
select new
{
gu,
cu
}
使用LinqPad 生成查询并学习 Linq
【讨论】:
ARHIEntities ARHModel = new ARHIEntities(); // ARHIEntities is the model name
var qry = from gu in ARHModel.gene_genunit
from cu in ARHModel.cont_unitati
where gu.COD_UNIT == cu.COD_UNIT
select new { cu, gu };
编辑:添加了where 子句
【讨论】: