The query provider does not know how to translate w.ops.Intersect(selecteditems)
into an SQL query.
If selecteditems
was another query from the same query provider, then he could translate them, or if the whole operation was performed in Linq-to-Objects, and not Linq-to-SQL, then be smart.
According to the error message, the only operation that he knows how to perform on such an object is Contains
. Instead, you can reuse your request:
.Where(w => selecteditems.Count == 0 || w.ops.Any(op => selecteditems.Contains(op)))
This [should] work.
Servy source share