title: Linq to SQL replace .Any() with .Contains()
body: <p>Got a dictionary with the persons Id as a key. And each value is a List with a class that contains a datetime.</p>
  
  <p>I want to get all contracts from the database where each date in the list is in between the contracts from and until -date. There could be multiple for each person.</p>
  
  <p>I can't use .Any() function. If I do I'll get this error: " Local sequence cannot be used in LINQ to SQL implementation of query operators except the Contains() operator."</p>
  
  <p>This is an example with the .Any method that doesn't work with linq to sql. And I need an other way to manage this.</p>
  
  <pre><code>public class SimpleObject
      {
          public bool Test { get; set; }
          public DateTime DateTime { get; set; }
      }
  
      private void Test(Dictionary&lt;int, List&lt;SimpleObject&gt;&gt; dataBaseObjDictionary)
      {
          using (var db = TpContext.Create())
          {
              var selectedObj = db.Contracts.Where(x =&gt; dataBaseObjDictionary.ContainsKey(x.PersonRef) &amp;&amp; dataBaseObjDictionary.Values.Any(y =&gt; y.Any(a =&gt; x.FromDate &lt;= a.DateTime) &amp;&amp; y.Any(a=&gt;a.DateTime &gt;= x.UntilDate)));
          }
      }
  </code></pre>