I am trying to write a LINQ statement using Entity Framework. I am getting an error stating "Expanding the Results View will enumerate the Enumerable" My query is as follows :
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)
}
);
In LINQPad its working fine but in Visual Studio its not. Following is the image result which i am getting in LINQPad :
Please let me know where am I going wrong?
Following is the Screen Shot which i am getting when i expand the resultset: Expand Image
The message " "Expanding the Results View will enumerate the Enumerable"" is not an error, it's a warning saying that if you expand the + sign the query will be run against the DDBB.
Just click in the + and expand the results tree, it should be ok.