-
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 could not be translated when using a static ICollection/IList field #35024
Comments
Hi, everyone! I have the similar problem. I have created a static extension method for small cast
There is code
And there is the problem
But that's code is OK
I think that It's something similar, because the problem in EF Core 7.0.20, .NET 7 :) |
not a regression - also fails in EF7 |
QueryRootProcessor should convert the the collection into inline query root, but it doesn't match the expression shape properly because there is a convert node around it. This is the expression:
|
when list is non-static we evaluate it as parameter typed as |
…llection/IList field Problem was that when converting primitive collection to inline query root we were not matching the expression if it was constant wrapped in convert. Fix is to remove convert for the purpose of pattern match for the transformation. Fixes #35024
…llection/IList field Problem was that when converting primitive collection to inline query root we were not matching the expression if it was constant wrapped in convert. Fix is to remove convert for the purpose of pattern match for the transformation. Fixes #35024
static readonly ICollection<T>
&static readonly IList<T>
field into a query when using it inside of a.Contains()
When removing thestatic
keyword it seems to be able to execute the query.IEnumerable<T>
This is not an issue, is this because of the different.Contains()
that's being used?.Any(x => x.Equals(...)
also does not throw this exception.Code example:
In my class I have the following field (This can be an
static readonly IList<T>
orstatic readonly ICollection<T>
:My Repository class looks something like this:
StackTrace:
EF Core version: 8.0.3.0
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: .NET 8.0
Operating system: 10.0.19045.0
IDE: Visual Studio 2022 17.9.6
The text was updated successfully, but these errors were encountered: