LINQKit
LINQKit copied to clipboard
QueryOptimizer with EFCore?
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?
same problem here :-(
https://github.com/Thorium/Linq.Expression.Optimizer/issues/14
There is a fix now released, hopefully that helps.
@Thorium Should also this project be fixed?
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.
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