title: LINQ Exception: "Queries with local collections are not supported." but not using a local collection
body: <p>Using the AdventureWorks database's Products table as the example, I have created a DBML and extended the properties of the DataContext to include a new property:</p>
  
  <pre>
  partial class AdventureWorksDataContext
  {
    public IQueryable&lt;Product&gt; FinishedProducts
    {
      get { return Products.Where(p => p.FinishedGoodsFlag); }
    }
  }
  </pre>
  
  <p>The Products property is part of the generated DataContext and all I've done is add a Where from the Table&lt;Product&gt; so it returns an IQueryable.</p>
  
  <p>Now, the problem comes in when trying to query it like this (dumb example but one that should show the problem):</p>
  
  <p><code>var queryFinishedProducts = datacontext.FinishedProducts.Where(fp =&gt; fp.ProductID == datacontext.FinishedProducts.Max(p =&gt; p.ProductID));</code></p>
  
  <p>Iterating this query results in "Queries with local collections are not supported" exception. I don't understand why it would throw that error when there are no local collections being used. If I run it against the normal Products table (which is a <code>Table&lt;Product&gt;</code>):</p>
  
  <p><code>var queryProducts = datacontext.FinishedProducts.Where(fp =&gt; fp.ProductID == datacontext.Products.Max(p =&gt; p.ProductID));</code></p>
  
  <p>...it works fine. The only difference is that I added a Where to the <code>Table&lt;Product&gt;</code> and returned it as an <code>IQueryable&lt;Product&gt;</code>.</p>
  
  <p>Anyone have any ideas? </p>