Can't process set operations after client evaluation

Viewed 47
var result = result.Select(a => new Subject
{
    Problem = 
        a.BaseProblem
            .Select(baseProblem => new ProblemDTO
            {
                Comment = baseProblem.CommentsModel.Select(c => new CommentDTO 
                {
                    Id = c.Id,
                    Text = c.Text
                })
            })
        .Union(a.UserProblem
            .Select(userProblem => new ProblemDTO
                {
                    Comment = userProblem.CommentsModel.Select(e => new CommentDTO 
                    {
                        Id = e.Id,
                        Text = e.Text
                    })
                }))
});

I just need to get the Problem List and the relevant Comment list for each Problem.

Unable to translate set operation after client projection has been applied. Consider moving the set operation before the last 'Select' call.

It does not give any compile error but when I run the code it will give the above-mentioned error.

0 Answers
Related