title: Finding an element in a DbSet with a composite primary key
body: <p>I have the following model and am trying to find a specific object in a <code>DbSet</code>:</p>
  
  <pre><code>public class UserSkill
  {
      [Key, Column(Order = 1)]
      public int UserId { get; set; }
  
      [Key, Column(Order = 2)]
      [ForeignKey("Skill")]
      public int SkillId { get; set; }
  
      public virtual Skill Skill { get; set; }
  }
  </code></pre>
  
  <p>I've tried the following two ways of finding a certain <code>UserSkill</code> object (I'm passing the <code>DbSet</code> of <code>UserSkills</code> via the <code>ViewBag</code>):</p>
  
  <pre><code>ViewBag.UserSkills.Find(new { WebSecurity.CurrentUserId, item.SkillId })
  ViewBag.UserSkills.Find(new UserSkill(WebSecurity.CurrentUserId, item.SkillId))
  </code></pre>
  
  <p>But in both cases, I get an error: </p>
  
  <blockquote>
    <p>The number of primary key values passed must match number of primary key values defined on the entity.</p>
  </blockquote>
  
  <p>What am I missing? It seems to me that the primary key consists of two columns, and I'm providing the find function with the two values that comprise the primary key.</p>