title: How do I map a composite primary key in Entity Framework 4 code first?
body: <p>I'm getting to grips with EF4 code first, and liking it so far. But I'm having trouble mapping an entity to a table with a composite primary key.</p>
  
  <p>The configuration I've tried looks like this:</p>
  
  <pre><code>public SubscriptionUserConfiguration()
  
      {
                  Property(u =&gt; u.SubscriptionID).IsIdentity();
                  Property(u =&gt; u.UserName).IsIdentity();
      }
  </code></pre>
  
  <p>Which throws this exception:
  Unable to infer a key for entity type 'SubscriptionUser'.</p>
  
  <p>What am I missing?</p>