LINQ Join with Multiple Conditions in On Clause

前端 未结 4 784
小鲜肉
小鲜肉 2020-11-28 05:25

I\'m trying to implement a query in LINQ that uses a left outer join with multiple conditions in the ON clause.

I\'ll use the example of the following two tables

4条回答
  •  -上瘾入骨i
    2020-11-28 05:46

    Here you go with:

    from b in _dbContext.Burden 
    join bl in _dbContext.BurdenLookups on
    new { Organization_Type = b.Organization_Type_ID, Cost_Type = b.Cost_Type_ID } equals
    new { Organization_Type = bl.Organization_Type_ID, Cost_Type = bl.Cost_Type_ID }
    

提交回复
热议问题