title: Linq select objects in Database exists Dictionary Keys
body: <p>I want to query data from database by multiple primary keys at once by using Linq. However, I store my primary keys in <code>Dictionary&lt;int, string&gt;</code></p>
  
  <p><strong>My dictionary</strong></p>
  
  <pre><code>private Dictionary&lt;int,string&gt; dict = new Dictionary&lt;int, string&gt;
  {
      {1, "Value 1"},
      {2, "Value 2"},
      {3, "Value 3"},
      {4, "Value 4"},
      {5, "Value 5"},
      {6, "Value 6"}
  
   };
  </code></pre>
  
  <p><strong>In Raw SQL</strong></p>
  
  <pre><code>SELECT * FROM Article WHERE ArticleId IN (1,2,3,4,5,6);
  </code></pre>
  
  <p><strong>I have tried in Linq</strong></p>
  
  <pre><code>var article = new NewsEntities().Articles;
  var mainArticles = article.Where(a =&gt; dict.ContainsKey(a.ArticleId));
  
  foreach (var mainArticle in mainArticles)
  {
      Console.WriteLine(mainArticle.ArticleId);
  }
  </code></pre>
  
  <p><strong>The error I have got</strong></p>
  
  <blockquote>
    <p>System.NotSupportedException: 'LINQ to Entities does not recognize the
    method 'Boolean ContainsKey(Int32)' method, and this method cannot be
    translated into a store expression.'</p>
  </blockquote>