Linq to SQL problem

Posted by Ronnie Overby on Stack Overflow See other posts from Stack Overflow or by Ronnie Overby
Published on 2010-03-26T18:30:54Z Indexed on 2010/03/26 18:33 UTC
Read the original article Hit count: 470

Filed under:
|
|
|
|

I have a local collection of recordId's (integers).

I need to retrieve records that have every one of their child records' ids in that local collection.

Here is my query:

public List<int> OwnerIds { get; private set; }
...
filteredPatches = from p in filteredPatches
                  where OwnerIds.All(o => p.PatchesOwners.Select(x => x.OwnerId).Contains(o))
                  select p;

I am getting this error:

Local sequence cannot be used in Linq to SQL implementation of query operators except the Contains() operator.

I get that .All() isn't supported by Linq to SQL, but is there a way to do what I am trying to do?

© Stack Overflow or respective owner

Related posts about LINQ

Related posts about linq-to-sql