title: Many to "two" relationship adding extra FK (also not working)
body: <p>I have the following classes</p>
  
  <pre><code>public class Foo
  {
      public virtual int Id { get; protected set; }
      public virtual IEnumerable&lt;Bar&gt; Bars { get; protected set; }
  }
  
  public class Bar
  {
      public virtual int Id { get; protected set; }
      public virtual Foo Foo1 { get; set; }
      public virtual Foo Foo2 { get; set; }
  }
  </code></pre>
  
  <p>with the following (presumably incorrect) mappings</p>
  
  <pre><code>public class FooMap : ClassMap&lt;Foo&gt;
  {
      public FooMap()
      {
          this.Id(x =&gt; x.Id);
          this.HasMany(x =&gt; x.Bars);
      }
  }
  
  public class BarMap : ClassMap&lt;Bar&gt;
  {
      public BarMap()
      {
          this.Id(x =&gt; x.Id);
          this.References(x =&gt; x.Foo1);
          this.References(x =&gt; x.Foo2);
      }
  }
  </code></pre>
  
  <p>When creating the tables, FNH is doing the following:</p>
  
  <pre><code>create table "Bar" (
      Id  integer primary key autoincrement,
     Foo1_id INT,
     Foo2_id INT,
     Foo_id INT,
     constraint FK52E419EE7F0CDD3 foreign key (Foo1_id) references "Foo",
     constraint FK52E419EE3C0DCDD3 foreign key (Foo2_id) references "Foo",
     constraint FK52E419EE34BDF7FF foreign key (Foo_id) references "Foo"
  )
  </code></pre>
  
  <p>i.e. has an extra FK reference.</p>
  
  <p>This means that calling <code>someBar.Foo1</code> is fine, but calling <code>soFoo.Bars</code> is always empty.</p>
  
  <p>I've looked into using</p>
  
  <pre><code>this.HasMany(x =&gt; x.Bars).KeyColumns.Add("Foo1_id", "Foo2_id");
  </code></pre>
  
  <p>but this returns the error:</p>
  
  <blockquote>
    <p>Foreign key (FK52E419EE660E4A59:Bar [Foo1_id, Foo2_id])) must have same number of columns as the referenced primary key (Foo [Id]).</p>
  </blockquote>
  
  <p>What is the correct way to map this form of relationship?</p>
  
  <hr>
  
  <p>To clarify the expected result if we have</p>
  
  <pre><code>Table:Foos   |  Table:Bars
  Id           |  Id    Foo1_id   Foo2_id
  --           |  -----------------------
  11           |  1     11        12
  12           |  2     12        11
  13           |  3     12        13
  </code></pre>
  
  <p>then <code>this.Session.Get&lt;Foo&gt;(11).Bars</code> should contain <code>Bar</code>s with <code>Id</code> of <code>1</code> and <code>2</code>.</p>