title: EF LINQ to SQL is getting whole table from DB instead of selection - where clause contains list with Any statement
body: <p>I have EF DataContext and would like to get data from SQL without getting full table from DB:</p>
  <pre><code>        List&lt;(int width, int height)&gt; dimensions = new List&lt;(int width, int height)&gt;();
  
          var res = context.DimensionData.Where(d =&gt; 
              dimensions.Any(dim =&gt; 
                  dim.width == d.Width &amp;&amp; dim.height == d.Height))
                  .ToList();
  </code></pre>
  <p>Using SQL Profiler I can see it will get full table and do slow in memory search.</p>
  <p>How can I write Query so processing is done in DB?</p>
  <p>I assume answering problem with SQL code and going back to Linq could give an answer how to do it.
  It seems a temp table needs to be generated for inner join and I am not sure how or if Linq is capable of this.</p>
  <p>UPDATE 1:
  For now I've manage to find a package that does in memory collections join in DB: <a href="https://www.nuget.org/packages/EntityFrameworkCore.MemoryJoin" rel="nofollow noreferrer">https://www.nuget.org/packages/EntityFrameworkCore.MemoryJoin</a></p>
  <p>Unfortunately project is still on .Net Core 2.2 and cant upgrade to .Net Core 3.x because have breaking changes from base packages I need to use.</p>
  <p>UPDATE 2:</p>
  <p>0.5.7 version of MemoryJoin package worked for me as @Ivan Stoev suggested</p>
  <pre><code>SELECT [d].[Id], [d].[Width], [d].[Height]
  FROM [DimensionData] AS [d]
  INNER JOIN (
      SELECT [x].[int1] AS [Width], [x].[int2] AS [Height]
      FROM (
          SELECT * FROM (VALUES (1, 55, 66), (2, 88, 99)) AS __gen_query_data__ (id, int1, int2)
      ) AS [x]
  ) AS [t] ON ([d].[Width] = [t].[Width]) AND ([d].[Height] = [t].[Height])
  </code></pre>