title: postgresql mapping many to many returns error
body: <p>Hi I'm looking for some helpful tips for my current mapping. It returns the following error when I tried to add the migration. I'm not too sure what I did wrong, or this is not how I'm supposed to map them.</p>
  
  <blockquote>
    <p>System.Reflection.TargetInvocationException: Exception has been thrown
    by the target of an invocation. ---> System.InvalidOperationException:
    Cannot create a relationship between 'Brokers.ManifestToBrokers' and
    'ManifestToBroker.ACASBroker', because there already is a relationship
    between 'Brokers.ManifestToBrokers' and 'ManifestToBroker.ABIBroker'.
    Navigation properties can only participate in a single relationship.</p>
  </blockquote>
  
  <p>I have 3 tables, Manifest, ManifestToBroker, Brokers. </p>
  
  <pre><code>public class Manifest
  {
      public virtual ManifestToBroker ManifestToBroker { get; set; }
      .......other stuff
  }
  
  public class ManifestToBroker
  {
      public virtual Manifest Manifest { get; set; }
  
      public int ManifestId { get; set; }
  
      public int? ABIFilerId { get; set; }
  
      public int? ACASFilerId { get; set; }
  
      public int? AMSFilerId { get; set; }
  
      public virtual Brokers ABIBroker { get; set; }
  
      public virtual Brokers ACASBroker { get; set; }
  
      public virtual Brokers AMSBroker { get; set; }
  }
  
  public class Brokers
  {
      [StringLength(32)]
      [Required(AllowEmptyStrings = false)]
      public string Name { get; set; }
  
      [StringLength(50)]
      public string Description { get; set; }
  
      [StringLength(100)]
      public string Contacts { get; set; }
  
      [Required]
      public int BrokerType { get; set; }
  
      [Required]
      public bool SupportABI { get; set; }
  
      [Required]
      public bool SupportACAS { get; set; }
  
      [Required]
      public bool SupportAMS { get; set; }
  
      public virtual ICollection&lt;ManifestToBroker&gt; ManifestToBrokers { get; set; } = new List&lt;ManifestToBroker&gt;();
  }
  </code></pre>
  
  <p>I have put all the mapping in ManifestToBrokerMapper for simplicity.</p>
  
  <pre><code>public class ManifestToBrokerMapping : IntKeyBaseBaseEntityConfiguration&lt;ManifestToBroker&gt;
  {
      protected override void ConfigureThis(EntityTypeBuilder&lt;ManifestToBroker&gt; builder)
      {
          builder.HasKey(m =&gt; m.Id);
          builder.HasOne(m =&gt; m.ABIBroker)
              .WithMany(m =&gt; m.ManifestToBrokers)
              .HasForeignKey(m =&gt; m.ABIFilerId);
          builder.HasOne(m =&gt; m.ACASBroker)
              .WithMany(m =&gt; m.ManifestToBrokers)
              .HasForeignKey(m =&gt; m.ACASFilerId);
          builder.HasOne(m =&gt; m.AMSBroker)
              .WithMany(m =&gt; m.ManifestToBrokers)
              .HasForeignKey(m =&gt; m.AMSFilerId);
          builder.HasOne(m =&gt; m.Manifest)
              .WithOne(m =&gt; m.ManifestToBroker)
              .IsRequired();
          builder.HasIndex(m =&gt; new { m.ManifestId, m.ABIFilerId }).IsUnique();
          builder.HasIndex(m =&gt; new { m.ManifestId, m.ACASFilerId }).IsUnique();
          builder.HasIndex(m =&gt; new { m.ManifestId, m.AMSFilerId }).IsUnique();
      }
  }
  </code></pre>