0
我正嘗試從SQL帶來了一些數據,但我不能使用LINQ做到這一點,在T-SQL這一工作:Helpme從SQL轉換爲LINQ嵌套lambda表達式用的EntityFramework
select *
from MTRBatch MB
Inner Join MTR M on MB.Id = M.MTRBatchId
Inner JOIN MTRHeats MH on M.Id = MH.MTRId
LEFT OUTER JOIN Vendor V on MB.VendorId = v.Id
Inner Join Manufacturer MF on MB.ManufacturerId = MF.Id
Where MB.ManufacturerId = 1
AND MH.Heat = 'z01'
我需要所有樹,但與該過濾器。
我嘗試這一點,但沒有工作:
MTRBatches
.Include(x => x.MTRs.Select(m => m.MTRHeats))
.Include(x => x.Manufacturer)
.Include(x => x.Vendor)
.Where(x => (x.Manufacturer.Id == 1));
.Where(x => x.MTRs.Any(m => m.MTRHeats.Any(h => h.Heat == 'z01')));
沒有在...中工作嗎?錯誤的結果?崩潰燒傷?沒有編譯? –
結果不正確: 它帶給我所有的地鐵,就像MH.HEAT過濾器沒有發生 – Crisler12