-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
Query: Prevent client evaluation when using certain result operators in complex query #7096
Comments
@AsValeO can you also post your model? Specifically code listings of all entities used and the contents of OnModelCreating method on the DbContext |
ProxyServer.cs - entity
ProxyServerLoadResult.cs - entity
OnModelCreating
|
@AsValeO as a workaround try putting Take(100) at the end of the query like so: await
db.ProxyServerLoadResult.AsNoTracking()
.Include(x => x.ProxyServer)
.Where(x => !x.ProxyServer.BlockedByOperator)
.Where(x => x.SourceId == 1)
.OrderByDescending(x => x.Score)
.Select(x => x.ProxyServer)
.Take(100)
.ToListAsync(); this produces a much simpler query from the EF perspective, that we are able to fully translate at the moment. If possible, you should always try to put Skip/Take/Distinct as the last operation when using EF Core (at least until we address the current limitations). The reason is that those are what we call ResultOperators - they are always the last operation in a given query. If there are more operations following, we introduce subqueries, which complicates the translation significantly for some cases. E.g. the original intermediate model representation for your original query is:
and the proposed workaround:
|
@maumar, I got it, thank you! |
This is fixed in the current bits and produces the following query:
|
@maumar I think I've encountered this issue also. When you say fixed, do you mean this will be included in the Entity Framework Core 2.0 release? EDIT: I see it was included in preview 1 |
Steps to reproduce
The issue
I guess this warning is wrong. Am I right?
Further technical details
EF Core version: 1.1.0
Operating system: Windows 10
Visual Studio version: VS2015U3
The text was updated successfully, but these errors were encountered: