一尘不染

如何在LINQ中选择多个表?

sql

在SQL中,我有:

 SELECT gu.*, cu.*
 FROM [gene_genunit] as gu, [cont_unitati] as cu
 WHERE gu.COD_UNIT = cu.COD_UNIT

我有一个WPF应用程序。


阅读 134

收藏
2021-03-08

共1个答案

一尘不染

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子句

2021-03-08