I'm trying to do a left join on a constant like this:
SELECT
[t0].[DeviceId],
[t0].[DeviceTypeId],
[t0].[UnitId],
[t0].[UnitNum],
[t0].[ManPhone],
[t0].[Status],
[t2].[MaintDate] AS [ServiceExpiration]
FROM [dbo].[Devices] AS [t0]
INNER JOIN [dbo].[CustomerDevices] AS [t1]
ON ([t0].[DeviceId]) = [t1].[DeviceId]
LEFT JOIN [dbo].[Maintenance] AS [t2]
ON ([t0].[DeviceId]) = [t2].[DeviceId]
AND 8 = [t2].ActionId
I get a CS1941 when I attempt it in LINQ like this:
var devices = from d in db.Devices
join cd in db.CustomerDevices
on d.DeviceId equals cd.DeviceId
join serviceExpiration in db.Maintenances
on
new { d.DeviceId, ActionId = 8 } // CS1941
equals
new { serviceExpiration.DeviceId, ActionId = serviceExpiration.ActionId } into j1
from deviceServiceExpiration in j1.DefaultIfEmpty()