-
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
EF core 3 global query filter cannot translate contain expression #18465
Comments
What is the type of |
The |
Could be duplicate of #17342 |
Putting |
@dimz87 - can you share a small repro code which demonstrate the issue? |
Sorry, i have clarify my comment, pleas see my comment |
In the EF Core version 2.2 i can create a query filter with contain as the filtering expression, in the version 3.0 it will throw exception that showing it cannot be translated.
Steps to reproduce
In the db context class create an entity with query filter
The filter will always produce exception:
The LINQ expression 'Where<Company>( source: DbSet<Company>, predicate: (c) => (Unhandled parameter: __ef_filter__p_0) || (Unhandled parameter: __ef_filter___companyCodes_1).Contains(c.Code))' 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 either AsEnumerable(), AsAsyncEnumerable(), ToList(), or ToListAsync(). See https://go.microsoft.com/fwlink/?linkid=2101038 for more information.
As it is located in the queryfilter i cannot use asasyncenumberable or to list, how to mitigate this issue in ef 3 ?
Further technical details
EF Core version: 3.0
Database provider: Microsoft.EntityFrameworkCore.SqlServer
Target framework: .NET Core 3.0
Operating system: Windows 10
IDE: Visual Studio 2019 16.3.5
The text was updated successfully, but these errors were encountered: