title: Fluent NHibernate mapping a composite ID from inherited composite IDs
body: <p>Let's say I have an existing database with the following 3 tables:</p>
  
  <p>Table1:<br>
  (PK)T1ID1<br>
  (PK)T1ID2</p>
  
  <p>Table2:<br>
  (PK)T2ID1</p>
  
  <p>Table3:<br>
  (FK)T1ID1<br>
  (FK)T1ID2<br>
  (FK)T2ID1
  (Where the 3 keys come from the tables above)</p>
  
  <p><strong>My question is: How do I map Table3 with Fluent NHibernate?</strong><br>
  What is confusing to me is what to do about the fact that its composite keys come from 2 different tables. </p>
  
  <p>I have the following for the mappings for tables 1 and 2:</p>
  
  <pre><code>public class Table1
  {
      public virtual long T1ID1 { get; set; }
      public virtual long T1ID2 { get; set; }
  }
  
  public class Table2
  {
      public virtual long T2ID1 { get; set; }
  }
  
  public class Table1Map
  {
      public Table1Map()
      {
          Table("Table1");
  
          CompositeId()
              .KeyProperty(x =&gt; x.T1ID1, "T1ID1")
              .KeyProperty(x =&gt; x.T1ID2, "T1ID2");
      }
  }
  
  public class Table2Map
  {
      public Table2Map()
      {
          Table("Table2");
  
          Id(x =&gt; x.T2ID1, "T2ID1");
      }
  }
  </code></pre>