title: How do I create this reference mapping in Fluent NHibernate?
body: <p>Using Fluent NHibernate I need a clue how to map my Invoice class.</p>
  
  <pre><code>public class Buyer
  {
      public virtual int Id { get; set; }
  
      public virtual string Name { get; set; }
      public virtual string TaxRegNo { get; set; } 
      // .... more properties....
  }
  
  public class Invoice
  {
      public virtual int Id { get; set; }
  
      public virtual int IdBuyer { get; set; }
      public virtual Buyer Buyer { get; set; } 
      // ....more properties
  }
  </code></pre>
  
  <p>The problem is that I want to have in Invoice class:</p>
  
  <ul>
  <li>BuyerId - just an integer ID for reference and foregin key relationship</li>
  <li>a copy of almost all buyer properties (its accounting document and properties cannot be changed after confirmation) - as component</li>
  </ul>
  
  <p>I tried to this using following mapping but it doesn't work</p>
  
  <pre><code>    public InvoiceMap()
      {
          Id(x =&gt; x.Id);
  
          References(x =&gt; x.IdBuyer);
          Component(x =&gt; x.Buyer, BuyerMap.WithColumnPrefix("buyer_"));
      // ....more properties
      }
  </code></pre>