title: Good way to select multiple rows with non-scalar list of keys using Entity Framework 4
body: <p>I'm using EF 4 and I'm trying to find a good way to select records where the primary key uses multiple columns and using a list of objects to search from.  Here's what I've tried so far with no luck:</p>
  
  <p>I have a list of objects of type Foo.  Foo has two properties, A and B.  The primary key on the Order table is columns A and B.</p>
  
  <pre><code>var orders = (from o in context.Orders
                where FooList.Contains(new Foo { A = o.A, B = o.B }
                select o);
  </code></pre>
  
  <p>This throws an error that I can only use a scalar value.  From what I can tell, I would need the FooList to be a list of scalars.  I've also tried to join with my object list, but that didn't work either:</p>
  
  <pre><code>var orders = (from o in context.Orders
                join foo in FooList
                on new { foo.A, foo.B } equals new { o.A, o.B }
                select o)
  </code></pre>
  
  <p>Obviously, I could just iterate through all of the values in FooList, get the order that I need and update it, but this is extremely slow in my current situation (about 6000 values in FooList).</p>
  
  <p>Any ideas?</p>