title: EF Code First not generating join tables for n:m relationships
body: <p>I've been using <a href="http://www.entityframeworktutorial.net/code-first/configure-many-to-many-relationship-in-code-first.aspx" rel="nofollow">this tutorial</a> as a guide for code first n:m. I usually go with db first but for a school project I have to use code first...</p>
  
  <p>My 2 classes are as follows:</p>
  
  <pre><code>public class Product
  {
      public Product()
      {
          Stocks = new HashSet&lt;Stock&gt;();
          ServingUnits = new HashSet&lt;Unit&gt;();
          Orders = new HashSet&lt;Order&gt;();
      }
      public int ProductId { get; set; }
  
      [StringLength(128, MinimumLength = 1)]
      [Required]
      public string Title { get; set; }
  
      [StringLength(512, MinimumLength = 1)]
      public string Description { get; set; }
  
      public int ExperationPeriod { get; set; }
  
      public byte[] Image { get; set; }
  
      [Required]
      public DateTime DateCreated { get; set; }
  
      //foreign keys
      [Required]
      public int StockUnitId { get; set; }
  
      [Required]
      public string CreatedById { get; set; }
  
      [Required]
      public int ProductStateId { get; set; }
  
      [Required]
      public int ProductTypeId { get; set; }
  
      //navigation properties
  
      [ForeignKey("StockUnitId")]
      public virtual Unit StockUnit { get; set; }
  
      [ForeignKey("CreatedById")]
      public virtual ApplicationUser CreatedBy { get; set; }
  
      [ForeignKey("ProductStateId")]
      public virtual ProductState ProductState { get; set; }
  
      [ForeignKey("ProductTypeId")]
      public virtual ProductType ProductType { get; set; }
  
      public virtual ICollection&lt;Stock&gt; Stocks { get; set; }
      public virtual ICollection&lt;Unit&gt; ServingUnits { get; set; }
      public virtual ICollection&lt;Order&gt; Orders { get; set; }
  
  }
  </code></pre>
  
  <p>and the other:</p>
  
  <pre><code>public class Unit
  {
      public Unit()
      {
          Orders = new HashSet&lt;Order&gt;();
          ProductsStock = new HashSet&lt;Product&gt;();
          ProductsServe = new HashSet&lt;Product&gt;();
      }
      public int UnitId { get; set; }
  
      [StringLength(255, MinimumLength = 1)]
      [Required]
      public string Title { get; set; }
  
      [StringLength(128, MinimumLength = 1)]
      public string ShortName { get; set; }
      public string Description { get; set; }
  
      [Required]
      public double BasisFactor { get; set; }
  
      [Required]
      public DateTime DateCreated { get; set; }
  
      //foreign keys
      [Required]
      public string CreatedById { get; set; }
  
      //navigation properties    
      [ForeignKey("CreatedById")]
      public virtual ApplicationUser CreatedBy { get; set; }
  
      public virtual ICollection&lt;Product&gt; ProductsStock { get; set; }
      public virtual ICollection&lt;Product&gt; ProductsServe { get; set; }
      public virtual ICollection&lt;Order&gt; Orders { get; set; }
  }
  </code></pre>
  
  <p>But the join table doesn't exist in my database. Can anyone see what I'm doing wrong?</p>
  
  <p>Thanks</p>