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

QueryOptimizer with EFCore? #172

Open
AudriusButkevicius opened this issue Mar 10, 2022 · 5 comments
Open

QueryOptimizer with EFCore? #172

AudriusButkevicius opened this issue Mar 10, 2022 · 5 comments

Comments

@AudriusButkevicius
Copy link

Not sure whether this should work or not, but I'm struggling to use the query optimizer with EFCore.

Seems that a simple query such as the following one fails:

_context.Items.Include(o => o.Parts).AsExpandable(ExpressionOptimizer.visit).Take(10);

Returns an error:

System.Exception: encountered unknown LINQ expression: Extension [Microsoft.EntityFrameworkCore.Query.QueryRootExpression]

Is this expected?

@inf9144
Copy link

inf9144 commented Mar 3, 2023

same problem here :-(

Thorium/Linq.Expression.Optimizer#14

@Thorium
Copy link
Collaborator

Thorium commented Mar 8, 2023

There is a fix now released, hopefully that helps.

@StefH
Copy link
Collaborator

StefH commented Mar 8, 2023

@Thorium
Should also this project be fixed?

@Thorium
Copy link
Collaborator

Thorium commented Mar 8, 2023

I thin LinqKit already "handles" the Extension case (or rather, ignores Extensions) and the problem was only with the Linq.Expression.Optimizer.

I don't know why EF Core suddenly needs extensions to ExpressionTrees. So I don't know if the ignoring is the correct design, but definitely it sounds a bit suspicious that we have the LINQ "language" (which was made mathematically properly originally) and then we have some extensions, probably for injecting something impure.

@StefH
Copy link
Collaborator

StefH commented Mar 8, 2023

I also don't know why.

I noticed that this new version works nicely with my efcore 6/7 example in this project: https://github.com/StefH/QueryInterceptor.Core

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants