title: Using dictionary in LINQ Where clause
body: <p>I have a list of data called <code>DataList</code>. <code>DataList</code> is having field <code>id</code> and <code>UpdatedTime</code> and some other fields. On the other, I have a dictionary with just the <code>id</code> and its respective value <code>UpdatedTime</code>.
  Is there any way to filter DataList such that it satisfies the dictionary <code>itemIdAndUpdatedTimeFilter</code> item Id and their respective <code>UpdatedTime</code> is higher than that of the <code>DataList</code>'s <code>UpdatedTime</code>?</p>
  
  <pre><code>Dictionary&lt;int, DateTime&gt; itemIdAndUpdatedTimeFilter = getFilter();
  itemIdAndUpdatedTimeFilter.Add(1, dateA);
  itemIdAndUpdatedTimeFilter.Add(2, dateB);
  itemIdAndUpdatedTimeFilter.Add(3, dateC);
  
  var dataList = getData();
  
  var filtered = dataList.Where(d=&gt;itemIdAndUpdatedTimeFilter.ContainsKey(d.Id) &amp;&amp; itemIdAndUpdatedTimeFilter[d.Id] &lt; d.UpdatedTime)
  </code></pre>
  
  <p>The above LINQ statement ended up in following exception:</p>
  
  <blockquote>
    <p>LINQ to Entities does not recognize the method 'Boolean
    ContainsKey(Int32)' method, and this method cannot be translated into
    a store expression.</p>
  </blockquote>
  
  <p>Tried deleted the <code>ContainKey</code> condition and get the following instead:</p>
  
  <blockquote>
    <p>LINQ to Entities does not recognize the method 'System.DateTime
    get_Item(Int32)' method, and this method cannot be translated into a
    store expression.</p>
  </blockquote>
  
  <p>Desired query is such that:</p>
  
  <pre><code>SELECT FROM dataList
  WHERE (dataList.UpdatedTime &lt; dateA AND dataList.Id = 1)
  OR (dataList.UpdatedTime &lt; dateB AND dataList.Id = 2)
  OR (dataList.UpdatedTime &lt; dateC AND dataList.Id = 3)
  </code></pre>