title: Entity Framework matching a subset of an int
body: <p>I am implementing a search where I would like to partially match an entity's primary key. For example, if I would search for "123" it would return entities which have primary keys like:</p>
  
  <ul>
  <li>12345</li>
  <li>67123</li>
  <li>91234</li>
  </ul>
  
  <p>If this were a string, I'd attack it like this:</p>
  
  <pre><code>    public PartialViewResult QuickSearch(string searchTerm)
      {
          var results = db.MyEntities.Where(x =&gt; x.myProperty.Contains(searchTerm));
          return PartialView("QuickSearch_Results", results);
      }
  </code></pre>
  
  <p>However I'm at a loss on the best way to do this for an int. I'm looking for something like this:</p>
  
  <pre><code>    public PartialViewResult QuickSearch(int id)
      {
          var results = db.MyEntities.Where(x =&gt; x.myPropertyId.Contains(int));
          return PartialView("QuickSearch_Results", results);
      }
  </code></pre>
  
  <p>But obviously contains is not the right way to go. What would be a correct way of implementing this?</p>