複数のフィールドを介して2つのテーブルを結合するときに、Linqで内部結合を作成する方法を知りたいです。
たとえば、これがSQLに相当するとします。
SELECT tableOne.fieldThree
FROM table_One AS tableOne,
table_Two AS tableTwo,
WHERE
tableOne.fieldOne == tableTwo.fieldOne AND
tableOne.fieldTwo == tableTwo.fieldTwo;
私はこれを試しました:
tableTwo.Join(tableOne,
two => new { two.fieldOne, two.fieldTwo },
one => new { one.fieldOne, one.fieldTwo },
(two, one) => one.fieldThree)
.ToList();
しかし、コンパイラーは、メソッドが使用法から推測できないことを示すエラーを示します。
ありがとう。