You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm experiencing an issue with WithExpressionExpanding where it does not properly expand LINQ queries. The application throws a System.InvalidOperationException when using a custom expression within a query. However, manually expanding the expression using Expand() works as expected.
Steps to Reproduce
Here's a simplified example that demonstrates the issue:
The query should execute successfully and return the expected results.
Actual Behavior
A System.InvalidOperationException is thrown:
System.InvalidOperationException
HResult=0x80131509Message=The LINQ expression 'DbSet<ProductVersion>().Join(
inner:DbSet<Version>(),
outerKeySelector:p => EF.Property<int?>(p,"VersionId"),
innerKeySelector:a => EF.Property<int?>(a,"Id"),
resultSelector:(o,i)=>newTransparentIdentifier<ProductVersion,Version>(Outer=o,Inner=i)).Where(p => p.Inner.Major == __toFind_0.Major && p.Inner.Minor == __toFind_0.Minor && p.Inner.Patch == __toFind_0.Patch && p.Inner.Tag == __toFind_0.Tag)' could not be translated. Either rewrite the query in a form that can be translated, or switch to client evaluation explicitly by inserting a call to 'AsEnumerable', 'AsAsyncEnumerable', 'ToList', or 'ToListAsync'. See https://go.microsoft.com
Workaround 1
Manually expanding the expression using Expand() works:
I'm experiencing an issue with
WithExpressionExpanding
where it does not properly expand LINQ queries. The application throws aSystem.InvalidOperationException
when using a custom expression within a query. However, manually expanding the expression usingExpand()
works as expected.Steps to Reproduce
Here's a simplified example that demonstrates the issue:
Configure EF Core with `WithExpressionExpanding`:
Execute the query:
Expected Behavior
The query should execute successfully and return the expected results.
Actual Behavior
A
System.InvalidOperationException
is thrown:Workaround 1
Manually expanding the expression using
Expand()
works:Workaround 2
Using the AsExpandable() extension method works:
Environment
The text was updated successfully, but these errors were encountered: