このSQLクエリをLinqからラムダに変換しようとしましたが、成功しませんでした。テーブルのidに一致するテーブルの場所にあるレコードしか持っていません。SQLクエリは正常に機能しますが、ラムダは機能しません
SQL クエリ。
SELECT Document, Place, Record
FROM RequiredApplicationDocuments LEFT OUTER JOIN Places ON
RequiredApplicationDocuments.Id = Places.RequiredApplicationDocumentId
WHERE Places.SecondPlaceId = 4 OR Places.SecondPlaceId IS NULL
ラムダ
Database.RequiredApplicationDocuments.Join(Database.Placess,
ra => ra.Id, fa => fa.RequiredApplicationDocumentId, (fa, ra) =>
new {Places = fa, RequiredApplicationDocument = ra}).DefaultIfEmpty().toList().Select(fa => new Places
{
FileName = fa.RequiredApplicationDocument.FileName,
LoanApplicationId = fa.RequiredApplicationDocument.LoanApplicationId,
Name = fa.RequiredApplicationDocument.Name,
RequiredApplicationDocument = fa.RequiredApplicationDocument.RequiredApplicationDocument,
Id = fa.Places.Id,
CreationDate = fa.RequiredApplicationDocument.CreationDate,
Contents = fa.RequiredApplicationDocument.Contents,
RequiredApplicationDocumentId = fa.RequiredApplicationDocument.RequiredApplicationDocumentId,
LoanApplication = fa.RequiredApplicationDocument.LoanApplication,
Type = fa.RequiredApplicationDocument.Type
}).AsQueryable();