C#C
C#3y ago
Morricore

❔ [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));


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.


upd. Found mention of mine issue.
https://stackoverflow.com/a/27295828
No solution
Was this page helpful?