'Problem in Search From One List in Another List in Ef .Net Core
List<string> groupId = request.GroupId.Split(',').ToList();
ENTITIES.ProductGroup
.Where(p => p.IsDisplay)
.Where(p => p.FK_GroupNavigation.IsDisplay)
.Where(p => groupId.Any(g => g == (p.FK_Group ?? 0) + "")
.ToList();
The value in request.GroupId is "12,15" and the same values are in the table, but give the following error.
In Ef Core I want to search for some value in another list but it gives the following error What is the problem?
TargetFramework=5.0
The LINQ expression 'DbSet() .Where(p => p.IsDisplay) .LeftJoin( inner: DbSet(), outerKeySelector: p => EF.Property<Nullable>(p, "FK_Group"), innerKeySelector: g => EF.Property<Nullable>(g, "PK_Group"), resultSelector: (o, i) => new TransparentIdentifier<ProductGroup, Group>( Outer = o, Inner = i )) .Where(p => p.Inner.IsDisplay) .Count(p => __groupId_0 .Any(g => (g ?? "").Equals((object)(p.Outer.FK_Group ?? 0) + "")))' 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'.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
