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've created a very sample solution to reproduce the issue:
I only use the LinqKit.Microsoft.EntityFrameworkCore 5.0.x package, do I need something more?
The code below was working fine in EF 6 with the corresponding NuGet package, and as far as I understand when reading the readme of this repo, it should still work with EF Core 5.x, am I right?
I also tried to call .Expand() on the expression created by the FilterNames(...), but the same error occurs.
I also tried to use a expression instead of the func (name => student.Name.Contains(name)) and than call .Compile() on the expression, but the same error occurs.
I got this exception:
System.InvalidOperationException: 'The LINQ expression 'DbSet()
.Where(s => __names_0
.Any(name => s.Name.Contains(name)))' 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/fwlink/?linkid=2101038 for more information.'
This is EF Core limitation. With local collections it can do only Contains or VERY simple Any, which is not your case. Check my SO answer
Thx for the answer, I solved it quite similar, but I hoped there is a way to make it work. Do you know any details about the EF Core limitation? If so I would open an issue in the EF core repo.
I've created a very sample solution to reproduce the issue:
I only use the LinqKit.Microsoft.EntityFrameworkCore 5.0.x package, do I need something more?
The code below was working fine in EF 6 with the corresponding NuGet package, and as far as I understand when reading the readme of this repo, it should still work with EF Core 5.x, am I right?
I also tried to call .Expand() on the expression created by the FilterNames(...), but the same error occurs.
I also tried to use a expression instead of the func (name => student.Name.Contains(name)) and than call .Compile() on the expression, but the same error occurs.
I got this exception:
System.InvalidOperationException: 'The LINQ expression 'DbSet()
.Where(s => __names_0
.Any(name => s.Name.Contains(name)))' 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/fwlink/?linkid=2101038 for more information.'
The text was updated successfully, but these errors were encountered: