我有这样的LINQ查询:
var query = (from c in entities.Contents
join m in entities.Moderations on c.ModId equals m.ModId
join mac in entities.ModActionCategories on c.ActionCategoryId equals mac.ActionCategoryId
where mac.WillAlert == true
select new DetailedContent
{
ActionCategoryId = c.ActionCategoryId,
ModId = c.ModId,
ContentSeqNum = c.ContentSeqNum,
ModTitle = m.ModerationTitle
}
);
return query.ToList();
当我执行它时,它会给出"枚举没有产生任何结果"错误。有趣的是,实际上查询会找到一些条目。当我将query
悬停并将生成的SQL查询复制/粘贴到MS SQL时,它会给出正确的结果。可能的原因是什么?