Я новичок в LINQ, и меня попросили обновить существующее унаследованное решение до Linq для сущностей в EF4.1.
Модель EF здесь
http://i53.tinypic.com/2h6sy0m.png
Я могу справиться с основными запросами, но обширные, такие как ниже, вызывают большие головные боли. Я был бы признателен за любой совет, который вы могли бы дать при конвертации в Linq (Return Me.ObjectContext. ** ....)
SELECT tblInspectionFailures.ID, vwBusinessUnit.Name, vwBuilds.BuildNo, tblFaultArea.Description AS [Fault Area], tblFault.Description AS Fault,
tblFaultsCodes.Description AS [Fault Code], tblFaultsCodesDetail.Description AS [Fault Code Detail],
tblFaultCode_AuditScores.Description AS [Audit Score], tblInspectionFailures.Comment, tblInspectionFailures.ShortagePart,
tblInspectionFailures.CreatedDate, vwUsers.DisplayName AS [Created By], tblInspectionFailures.IsAdhocTest, tblInspectionFailures.FixedDate
FROM tblInspectionFailures INNER JOIN
tblFaultArea ON tblFaultArea.ID = tblInspectionFailures.FaultAreaID INNER JOIN
vwBuilds ON tblInspectionFailures.BuildID = vwBuilds.ID INNER JOIN
tblFaultsCodes ON tblInspectionFailures.FaultCodeID = tblFaultsCodes.ID INNER JOIN
vwBusinessUnit ON tblInspectionFailures.BUID = vwBusinessUnit.ID INNER JOIN
vwUsers ON tblInspectionFailures.CreatedBy = vwUsers.ID INNER JOIN
tblFault ON tblInspectionFailures.FaultID = tblFault.ID LEFT OUTER JOIN
tblFaultCode_AuditScores ON tblInspectionFailures.AuditScoreID = tblFaultCode_AuditScores.ID LEFT OUTER JOIN
tblFaultsCodesDetail ON tblInspectionFailures.FaultCodeDetailID = tblFaultsCodesDetail.ID
WHERE (tblInspectionFailures.FaultAreaID IN (28, 72, 78))
AND (tblInspectionFailures.CreatedDate BETWEEN CONVERT(DATETIME, '2011-04-01 00:00:00', 102) AND GETDATE())