title: Entity Framework Multiple Column as Primary Key by Fluent Api
body: <p><em><strong>These are my simplified domain classes.</strong></em></p>
  <pre class="lang-cs prettyprint-override"><code>public class ProductCategory
  {
      public int ProductId { get; set; }
      public int CategoryId { get; set; }
  
      public virtual Product Product { get; set; }
      public virtual Category Category { get; set; }
  }
  
  public class Product
  {
      public int Id { get; set; }
      public string Name { get; set; }
  } 
  
  public class Category
  {
      public int Id { get; set; }
      public string Name { get; set; }
      public int? ParentCategoryId { get; set;} 
  } 
  </code></pre>
  <p><em><strong>This is my mapping class. But it doesn't work.</strong></em></p>
  <pre class="lang-cs prettyprint-override"><code>public class ProductCategoryMap : EntityTypeConfiguration&lt;ProductCategory&gt;
  {
      public ProductCategoryMap()
      {
          ToTable(&quot;ProductCategory&quot;);
          HasKey(pc =&gt; pc.ProductId);
          HasKey(pc =&gt; pc.CategoryId);
      }
  }
  </code></pre>
  <p><em><strong>How should I map these classes to provide, so that one product can be seen in multiple categories?</strong></em></p>