title: Mixing raw SQL with IQueryable for dynamic filter
body: <p>In entity framework 6 is it possible to mix raw SQL generated dynamically with IQueryable like this:</p>
  
  <pre><code>IQueryable&lt;Tree&gt; tree_query = context.Trees.Where(t=&gt;t.Height&gt; 2);
  IEnumerable&lt;int&gt; tree_additional_filter = context.Database.SqlQuery&lt;int&gt;("SELECT Id FROM TREE_VIEW WHERE Width &lt; 1");
  
  IQueryable&lt;Tree&gt; final_query = from tree in tree_query 
                                 join filtering_tree in tree_additional_filter on filtering_tree.id equals tree.id
                                 select tree;
  </code></pre>
  
  <p>This produces a result as is, but the "tree_additional_filter" is executed in the database in order to construct the final_query. How can I make entity framework construct only one query from this?</p>
  
  <p>I need this to create dynamic filter fields which work together with static ones.</p>
  
  <p>I also tried creating TREE_VIEW entity with only Id column, which I know to always be there.
  Used System.Linq.Dynamic to construct "where" clause dynamically on a TREE_VIEW entity which has only Id property, but apparently expressions can't be built if properties do not exist in the Type.</p>