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
System.InvalidOperationException : The LINQ expression 'Where<Blog>(
source: DbSet<Blog>,
predicate: (b) => (Unhandled parameter: __ids_0).Contains(b.BlogId))' 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.
When
ICollection<T>
is used inWhere(...)
it does not generate proper SQL query and crashes with request for query rewrite.Steps to reproduce
I've created following repo https://github.com/jirkafajfr/EfCore-CollectionInExpressionProblem which demonstrates the problem. Essentially when
ICollection<T>
comes to the expression it can't be translated where array or list would work just fine.Crashes
Works fine
Notes
The attached repo demonstrates that this used to work in EfCore 2.2 but is not broken with EfCore 3.0
Further technical details
EF Core version: 3.0
Database provider: Microsoft.EntityFrameworkCore.Sqlite, Npgsql.EntityFrameworkCore.PostgreSQL
Target framework: .NET Core 3.0
Operating system: Windows 10, Linux (attached docker)
IDE: Visual Studio 2019 16.3
The text was updated successfully, but these errors were encountered: