-3
我有這個linq代碼,我需要將它轉換成相同的SQL,因此我可以直接查詢數據庫...當它變得複雜時,我會卡住。誰能幫忙?將此Linq轉換爲SQL
的LINQ
_db.BatchPaymentSplits
.Where(bps => bps.YearSetupId == i.YearSetupId)
.Where(bps => bps.CustomerIdEntered != null)
.Where(bps => _db.BatchPayments
.Where(bp => _db.Batches.Where(b => b.BatchTypeId.Equals("T"))
.Select(b => b.BatchId)
.Contains(bp.BatchId)
)
.Select(bp => bp.BatchPaymentId).Contains(bps.BatchPaymentId)
)
SQL至今
SELECT * FROM BatchPaymentSplit
WHERE YearSetupId = 1
AND CustomerIdEntered IS NOT NULL
EF會告訴你它正在生成的SQL,我建議你使用它而不是在這裏問。 – DavidG
它會嗎?我可以使用中斷點看到它嗎? – CheezStix
谷歌是你的朋友...只是做'.ToString()'是一個谷歌是你的朋友... https://stackoverflow.com/questions/1412863/how-do-i-view-the-sql-generated-by-the-entity-framework – DavidG