title: EF Core 3 x.Contains() in expression where x is ICollection
body: <p>I've got the following data layer setup:</p>
  
  <pre><code>public class Repository : IRepository {
  
      private readonly MyDbContext _dbContext;
  
          public List&lt;Meter&gt; Search(Expression&lt;Func&lt;Meter,bool&gt;&gt; criteria)
              IQueryable&lt;Meter&gt; results = _dbContext.Meters;
              return results.Where(criteria).ToList();
          }
      }
  }
  
  ... from a client class:
  
  IRepository _repository;
  
  public void ClientMethod () {
  
      ICollection&lt;int&gt; ids = new List&lt;int&gt;() {1, 2, 3);
      var results = _repository.Search(c=&gt; ids.Contains(c.Id)); // This throws exception
  
  }
  </code></pre>
  
  <p>This results in the exception:</p>
  
  <blockquote>
    <p>expression Where(source: DbSet, predicate: (m) =>
    (Unhandled parameter: __ids_0).Contains(m.Id))' could not be
    translated. Either rewrite the query in a form that can be translated,
    or switch to client evaluation explicitly by inserting a call to
    either AsEnumerable(), AsAsyncEnumerable(), ToList(), or ToListAsync()</p>
  </blockquote>
  
  <p>But if I change the collection reference to IEnumerable or List, it works:</p>
  
  <pre><code>public void ClientMethod () {
  
      // This works
      List&lt;int&gt; ids = new List&lt;int&gt;() {1, 2, 3);
      var results = _repository.Search(c=&gt; ids.Contains(c.Id)); 
  
      // This works
      IEnumerable&lt;int&gt; ids = new List&lt;int&gt;() {1, 2, 3);
      var results = _repository.Search(c=&gt; ids.Contains(c.Id)); 
  }
  </code></pre>
  
  <p>Why is it not working for ICollection, but it does for IEnumerable and List? Many of my client methods take an ICollection as a parameter.</p>
  
  <p>I'm using EF Core 3.0 but I believe I had the same problem in 2.1, it just didn't throw as it evaluated it on the client instead.</p>