C
C#2y ago
Morridis

❔ [EF Core] e => locationsIds.Any(id => e.Location.ParentsIds.Contains(id)); could not be translated

Expression type Expression<Func<Sensor, bool>> where Sensor has field Location. Location has string field ParentsIds, containing bunch of Location ID's. Code:
C++
var locationsIds = locations.Select(e => e.Id.ToString()).ToList();
return e => locationsIds.Any(id => e.Location.ParentsIds.Contains(id));
C++
var locationsIds = locations.Select(e => e.Id.ToString()).ToList();
return e => locationsIds.Any(id => e.Location.ParentsIds.Contains(id));
Exception:
C++
The LINQ expression 'id => EntityShaperExpression:
Domain.Location
ValueBufferExpression:
ProjectionBindingExpression: Inner
IsNullable: False
.ParentsIds.Contains(id)' 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.
C++
The LINQ expression 'id => EntityShaperExpression:
Domain.Location
ValueBufferExpression:
ProjectionBindingExpression: Inner
IsNullable: False
.ParentsIds.Contains(id)' 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.
upd. Found mention of mine issue. https://stackoverflow.com/a/27295828 No solution
1 Reply
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server