linq2sql的交叉连接问题

时间:2011-05-31 02:10:48

标签: vb.net visual-studio-2010 linq-to-sql

我有以下LINQ2SQL查询:

From pc In DBContext.ProcessCodes
Join c In DBContext.Cells On pc.idCell Equals c.idCell
    Where pc.idType = "Cars" AndAlso
          pc.Active = True AndAlso
          c.Active = True
    Select c

出于某种原因,当我认为我应该获得内部联接时,我正在获得交叉加入(笛卡尔积)。如果我在where中进行多次From与密钥比较,我会得到同样的东西。

我做错了什么?

1 个答案:

答案 0 :(得分:0)

我认为这有助于你:

From pc In DBContext.ProcessCodes 
From c In DBContext.Cells
Where pc.idType = "Cars" AndAlso           
      pc.Active = True AndAlso
      c.Active = True     
Select c 
相关问题