title: Entity Framework 6 Adding properties to join tables
body: <p>This is the scenario:
  I have a products table and a categories table. The relationship is many-to-many: a category can have 1 or more products....and a product can be in 1 or more categories...</p>
  
  <p>The Code-First mapping looks like this....</p>
  
  <pre><code>public class Product
  {
    //...additional properties...
    public virtual ICollection&lt;Category&gt; AssociatedCategories {get; set;}
  }
  
  public class Category
  {
    //...additional properties...
    public virtual ICollection&lt;Product&gt; AssociatedProducts {get; set;}
  }
  </code></pre>
  
  <p>Now, under the hood, entity framework will create a join table called ProductCategory with columns ProductID and CategoryID. That's great....</p>
  
  <p>Here's the thing though, I need to introduce a sort order...basically just a cardinal positioning index, but this number exists only at the part in the relationship where product and category meet each other. For example, a product X might have a sort order value of "5" in Category Y, but that some product--X--could have a different sort value--say 10--in Category Z.</p>
  
  <p>Naturally, I could create an entity specifically for this type of thing...but it would require a new table be made...there would be 3 columns for the Category ID, Product ID, and sort order. What I'd really like to be able to do is tap into the table that entity framework already made....it will already keep track of products IDs and category IDs in the join table....is there any way to make use of the table that already exists?</p>