I am trying to run the following query:
IQueryable<ProvisioningQueueView> query = (from pq in metaData.ProvisioningQueue
from pat in metaData.ProvisioningActionTypes.Where(actionType => actionType.Id == pq.ProvisioningActionTypeId).DefaultIfEmpty()
join prt in metaData.ProvisioningRequestTypes
on pq.ProvisioningRequestTypeId equals prt.Id
join pst in metaData.ProvisioningStatusTypes
on pq.ProvisioningStatusTypeId equals pst.Id
select new ProvisioningQueueView
{
Id = pq.Id,
MerchantId = pq.MerchantId,
PrivateLabelId = pq.PrivateLabelId,
Action = pat.Description ?? string.Empty,
DomainName = pq.DomainName,
ExternalIp = pq.ExternalIpAddress,
ProcessDate = pq.ProcessDate,
Request = prt.Description,
Status = pst.Description,
StoreId = pq.StoreId
});
However, I receive the following error as a result:
A DefaultIfEmpty() call was found on an entity typed sequence as one side of a join. However, the behavior of the DefaultIfEmpty can't be converted to SQL due to the lack of a predicate or filter to combine left side with right side.
I don't understand what's going on because when I run this in Linqpad as Linq to SQL it works perfectly.
Ultimately, what I need to do is a left join with ProvisioningActionTypes and set the default value to the empty string if the value coming in from that table is null. I thought I could do that with the above query, but LLBLGen doesn't seem to support that.
Does anyone have some suggestion as to what to try instead?