我在LINQ中執行左連接,並且遇到問題。我的問題是我在我的where子句中對兩個表進行比較,但我實際上無法訪問'cat'表。我如何去訪問左連接中的表格?無法訪問LINQ中的左連接實體
var query = from apple in Apple
join ball in Ball on apple.Id equals ball.AppleId
join cat in Cat on ball.Id equals cat.BallId into leftJoin
join dog in Dog on ball.Id equals dog.BallId
where apple.Id == 5
// At this point cat is not accessable. Cannot resolve symbol "cat".
where dog.CatName == cat.Name
from cat in leftJoin.DefaultIfEmpty()
select new
{
// select stuff here...
};
工作。我需要在where子句之前的DefaultIfEmpty()方法。謝謝! – Halcyon