title: Error in many-to-many relationship using Fluent API in Entity Framework 6 one model is self referencing
body: <p><code>Category</code> model is self referencing</p>
  
  <pre><code>public class Category
  {      
      [Key]
      public int CategoryID { get; set; }
  
      public string Name { get; set; }
  
      public int? ParentID { get; set; }
      public Category Cat { get; set; }
      public ICollection&lt;Category&gt; Categories { get; set; }
      public ICollection&lt;BusinessDetail&gt; BDetails { get; set; }        
  }
  </code></pre>
  
  <p>and <code>BusinessDetail</code> is like </p>
  
  <pre><code>public class BusinessDetail
  {
     [Key]
      public int ID { get; set; }
      [Required]
      [Display(Name="Business Name")]
      public string BusinessName { get; set; }
      public string Address { get; set; }
      [Display(Name="Contact")]
      public string contactDetail { get; set; }
  
      // public int CategoryID { get; set; }
      // public Category Category { get; set; }
      public int ? LocationID { get; set; }
      public Location Location { get; set; }
      [Display(Name="Website Address")]
      public string Website_Address { get; set; }
  
      [Display(Name="Is Verified")]
      public bool Is_verified { get; set; }
      [Required]
      [Display(Name="Added By")]
      public string Added_By { get; set; }
      [Required]
      [Display(Name="Added Date")]
      [DataType(DataType.DateTime)]
      public DateTime Added_Date { get; set; }
      [Display(Name="Is Featured")]
      public bool Is_Featured { get; set; }
  
      public string Latitude { get; set; }
      public string VerifiedBy { get; set; }
      public string Longitude { get; set; }
      public ICollection&lt;Category&gt; Categories { get; set; }
  }
  </code></pre>
  
  <p>When creating a many-to-many relationship using Fluent API</p>
  
  <pre><code>modelBuilder.Entity&lt;BusinessDetail&gt;()
     .HasMany(c =&gt; c.Categories).WithMany(i =&gt; i.BDetails)
     .Map(t =&gt; t.MapLeftKey("ID")
        .MapRightKey("CategoryID")
        .ToTable("BusinessCategories"));
  </code></pre>
  
  <p>I get this error</p>
  
  <blockquote>
    <p>There are no primary or candidate keys in the referenced table
    'dbo.BusinessDetails' that match the referencing column list in the
    foreign key 'FK_dbo.BusinessCategories_dbo.BusinessDetails_ID'.</p>
  </blockquote>
  
  <p>I need help on this error.</p>