一个项目刚刚从 linq-to-sql 切换到 linq-to-entities,现在我得到了错误
The LINQ expression node type 'ArrayIndex' is not supported in LINQ to Entities.
对于这一行:
var a = db.Table.Single(d => d.Date == dates[0]);
(在这种特殊情况下修复它很容易,如
var firstDate = dates[0];
var a = db.Table.Single(d => d.Date == firstDate);
)
但是为什么这在 linq-to-sql 中有效,但在 linq-to-entities 中无效?他们是否使 linq-to-entities 比 linq-to-sql 更糟糕?我错过了什么?