title: Entity Framework 5, Code First Many to Many foreign key mapping with extra property
body: <p>I have these classes</p>
  
  <pre><code>public class SecretQuestion
  {
      [Key]
      public int SecretQuestionId { get; set; }
      [Required]
      public string Caption { get; set; }
  }
  
  public class UserSecretQuestion
  {
      public SecretQuestion SecretQuestion { get; set; }
      public User User { get; set; }
  
      [Required]
      public string Answer { get; set; }
  }
  
  public class User
  {
      [Key]
      public int UserId { get; set; }
      public string Email { get; set; }
      public string UserName { get; set; }
  }
  </code></pre>
  
  <p>I want UserSecretQuestion to be a join table holding the user's Answer. The problem is that EF5 won't create this table for me because it claims I need a key on that table. </p>
  
  <p>so of course putting  <strong><em>public int Id { get; set; }</em></strong> in there will fix it but that puts a field I don't need in my database. </p>
  
  <p>Is there a way to make this work properly so that the secretquestionid and userid foreign keys form a composite key for the usersecretquestion table.</p>
  
  <p>I note that there are a few questions on here that talk about many to many relationships but none (that I can find) talk about this kind of relationship where the entity has extra data e.g. 'Answer'.</p>