here “i” is the Store (entity) has given and Orders is List stored in Customers as the column type as jsonb . I need to fetch the “i” if any one of the request.Orders is matches with any one of the e.Orders
query = query.Where(i => i.Customers != null && i.Customers.Any(e => e.Orders != null && e.Orders.Intersect(request.Orders).Any()));
This was the error message:
“One or more errors occurred. (The LINQ expression ‘DbSet()n.Where(p0 => EF.Property<Guid?>(EntityShaperExpression: n Lrb.Domain.Entities.Storen ValueBufferExpression: n ProjectionBindingExpression: Outern IsNullable: Falsen, “Id”) != null && object.Equals(nobjA: (object)EF.Property<Guid?>(EntityShaperExpression: n Lrb.Domain.Entities.StorenValueBufferExpression: n ProjectionBindingExpression: Outern IsNullable: Falsen, “Id”), n objB(object)EF.Property<Guid?>(p0, “StoreId”)))n .Any(p0 => p0.Orders != null && p0.Ordersn .Intersect(__request_Orders_1)n .Any())’ could not be translated. Additional information: Translation of method ‘System.Linq.Enumerable.Intersect’ failed. If this method can be mapped to your custom function, see https://go.microsoft.com/fwlink/?linkid=2132413 for more information. 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.)”