Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
abeerabdu opened this issue May 21, 2023 · 1 comment

Comments

@abeerabdu
Copy link

abeerabdu commented May 21, 2023

EF Core version: 6.0.16
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: .NET 6.0
Operating system: Win 10

After migrating from EF4 to EF6 and .NET 4 to .NET 6 we get the above error from this query

public IEnumerable<UserTaskView> GetUserTopTasks(IUnitOfWork unitOfWork, int admId, int ngoId, int maxNo = 10)
        {  
            var pagination = new DeadlinePaginationView { rows = maxNo };
            var tasksQry = unitOfWork.WorkplanSubactivity.GetAssignedTasksQuery(ngoId, admId);
            var mealsQry = unitOfWork.MealActivity.GetAssignedTasksQuery(ngoId, admId);
            var query = tasksQry.Union(mealsQry);
            var data = query.OrderBy(GetOrderByExpresstion(pagination.sortBy, pagination.descending))
                            .Skip(pagination.offset).Take(pagination.rows).ToList()
                            .Select(row =>
                            {
                                var result = unitOfWork.Admin.GetUserTaskModel(row);
                                return result;
                            }).ToList();
            return data;
        }
@ajcvickers
Copy link
Member

Duplicate of #16298. Make sure to vote (👍) for that issue.

@ajcvickers ajcvickers closed this as not planned Won't fix, can't repro, duplicate, stale May 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants