❔ [EF Core] e => locationsIds.Any(id => e.Location.ParentsIds.Contains(id)); could not be translated
Expression type
Expression<Func<Sensor, bool>>
Expression<Func<Sensor, bool>>
where
Sensor
Sensor
has field
Location
Location
.
Location
Location
has string field
ParentsIds
ParentsIds
, containing bunch of
Location
Location
ID's. Code:
var locationsIds = locations.Select(e => e.Id.ToString()).ToList(); return e => locationsIds.Any(id => e.Location.ParentsIds.Contains(id));
var locationsIds = locations.Select(e => e.Id.ToString()).ToList(); return e => locationsIds.Any(id => e.Location.ParentsIds.Contains(id));
Exception:
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.
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.