title: Passing A DbSet<T> created at runtime via reflection to Queryable
body: <p>I'm trying to execute a dynamic linq query where my DbSet Type is created at runtime via reflection an I'm getting the error:</p>
  
  <blockquote>
    <p>"The best overloaded method match for
    'System.Linq.Queryable.Where(System.Linq.IQueryable,
    System.Linq.Expressions.Expression>)'
    has some invalid arguments"</p>
  </blockquote>
  
  <p>Here's my code</p>
  
  <pre><code>MyDataContext db = new MyDataContext ();
  var dbType = db.GetType();
  var dbSet = dbType.GetProperty("MyType").GetValue(db,null);
  dbSet.GetType().InvokeMember("Local", BindingFlags.GetProperty, null, dbSet , null)
  //just to show that it equal
  dbSet.Equals(db.MyType); //returns true;
  //here i create a dynamic expression tree 
  dynamic l = Expression.Lambda(delagateType, greater, param);
  
  //here it fails when i pass in my dbSet var but not when i pass db.MyType
  dynamic q =   ((IEnumerable&lt;object&gt;)Queryable.Where(dbSet , l)).ToList();
  </code></pre>