无法在 LINQ to Entities 查询中构造实体或复杂类型“”

The entity or complex type '' cannot be constructed in a LINQ to Entities query

我正在尝试在两个表之间进行左连接并在运行时出现以下错误

错误消息 - 无法在 LINQ to Entities 查询中构造实体或复杂类型 'XactETLModel.XactETL_ShredQueue_Exceptions'。

var query = (from a in xactCtxt.dctShredCompletes 
                             join b in xactCtxt.XactETL_ShredQueue_Exceptions on a.QueueID equals b.QueueID
                             into c 
                             from d in c.DefaultIfEmpty( new XactETL_ShredQueue_Exceptions() )
                             where a.ShredCompleteDate >= startDate && a.ShredCompleteDate <= endDate
                             select new { a.QueueID , a.ShredMode ,a.ShredCompleteDate , d.ExceptionDate ,d.ErrorMessage }).ToList();

以下代码解决了这个问题。无需将右侧 table 作为 class

var query = (from a in xactCtxt.dctShredCompletes 
                         join b in xactCtxt.XactETL_ShredQueue_Exceptions on a.QueueID equals b.QueueID
                         into c 
                         from d in c.DefaultIfEmpty(  )
                         where a.ShredCompleteDate >= startDate && a.ShredCompleteDate <= endDate
                         select new { a.QueueID , a.ShredMode ,a.ShredCompleteDate , d.ExceptionDate ,d.ErrorMessage }).ToList();