我正在尝试使用Entity Framework编写LINQ语句。我收到错误说明"扩展结果视图将枚举可枚举" 我的查询如下:
IQueryable lis = (from que in _repo.Query<Question>()
where que.PresentationImageId == 1 join map in
_repo.Query<UserChildCourseQuestionMap>() on que.Id equals map.QuestionId into t
from rt in t.DefaultIfEmpty()
group t by que.Id
into g
select new
{
Id = g.Key,
QuestionBody = (from q in _repo.Query<Question>() where q.Id == g.Key select q.QuestionBody),
value = (from p in _repo.Query<UserChildCourseQuestionMap>()
where p.QuestionId == g.Key
select new
{
Name = gg.Key.AnswerOption,
Count = gg.Count(),
}).Union(from p in _repo.Query<UserChildCourseQuestionMap>()
where p.QuestionId == g.Key && p.UserInputText != null
group p by p.UserInputText into gg
select new
{
Name = gg.Key,
Count = gg.Count(),
}).Where(x => x.Name != null)
}
);
在LINQPad中它的工作正常,但在Visual Studio中却没有。以下是我在LINQPad中获得的图像结果:
请告诉我哪里出错?
以下是我在展开结果集时获得的屏幕截图: Expand Image
答案 0 :(得分:3)
消息“”扩展结果视图将枚举Enumerable“”不是错误,它是一个警告,如果展开+符号,将对DDBB运行查询。
只需单击+并展开结果树,就可以了。