C#C
C#3y ago
SWEETPONY

✅ can't translate linq query

I have following query:
var devices = dbContext.Set<Model.Entities.Device>()
    .Where(device => categories
        .Any(device.Categories.Contains))
    .WhereCanRead(currentOperator.Scope)
    .ToList();


And got error:
System.InvalidOperationException: The LINQ expression 'category => EntityShaperExpression:
    Parsec.Segment.Model.Entities.Device
    ValueBufferExpression:
        ProjectionBindingExpression: EmptyProjectionMember
    IsNullable: False
.Categories
    .Contains(category)' could not be translated. 


I tried to add
AsEnumerable
after
categories
and
device.Categories
but it doesn't work
Was this page helpful?