I have trying to convert this sql query to Linq to lambda and i have no success i only have the records that are in the table places that match the id on the table requireddocuments i want the nulls too. The sql query works fine but the lambda doesn't
SQL Query.
SELECT Document, Place, Record
FROM RequiredApplicationDocuments LEFT OUTER JOIN Places ON
RequiredApplicationDocuments.Id = Places.RequiredApplicationDocumentId
WHERE Places.SecondPlaceId = 4 OR Places.SecondPlaceId IS NULL
Lambda
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();
RequiredApplicationDocument.Places?