title: One to one relationship mapping with composite key
body: <p>I have a database like this:
  My question is "How to mapping this database using castle active record?"</p>
  
  <p><a href="http://cA4.upanh.com/11.396.15558077.LNS0/onetoonewithcompositekey.jpg" rel="nofollow noreferrer">alt text http://cA4.upanh.com/11.396.15558077.LNS0/onetoonewithcompositekey.jpg</a>
  I've tried this code:
  Campaign:</p>
  
  <pre><code>[ActiveRecord("[Campaign]")]
      public class Campaign : ActiveRecordBase&lt;Campaign&gt;
      {
          private long m_ID;
          [PrimaryKey(Column = "`ID`")]
          public long ID
          {
              get { return m_ID; }
          set { m_ID = value; }
      }
          //// Properties ...
          private IList&lt;MessageOfCampaign&gt; m_MessageOfCampaign = new List&lt;MessageOfCampaign&gt;();
          [HasMany(typeof(MessageOfCampaign),
              Table = "`MessageOfCampaign`",            
              ColumnKey = "`CampaignID`")]
          public IList&lt;MessageOfCampaign&gt; MessagesOfCampaign
          {
              get { return m_MessageOfCampaign; }
              set { m_MessageOfCampaign = value; }
          }
      }
  </code></pre>
  
  <p>MessageOfCampaign:</p>
  
  <pre><code>[Serializable]
      public class MessageOfCampaignKey
      {
          private long m_MessageID;
          [KeyProperty(Column = "`MessageID`")]
          public long MessageID
          {
              get { return m_MessageID; }
              set { m_MessageID = value; }
          }
  
          private long m_CampaignID;
          [KeyProperty(Column = "`CampaignID`")]
          public long CampaignID
          {
              get { return m_CampaignID; }
              set { m_CampaignID = value; }
          }
  
          public override bool Equals(object obj)
          {
              if (this == obj)
              {
                  return true;
              }
  
              MessageOfCampaignKey key = obj as MessageOfCampaignKey;
  
              if (key == null)
              {
                  return false;
              }
              if (m_CampaignID != key.m_CampaignID || !m_MessageID.Equals(key.m_MessageID))
              {
                  return false;
              }
              return true;
          }
  
          public override int GetHashCode()
          {
              return this.m_CampaignID.GetHashCode() ^ this.m_MessageID.GetHashCode();
          }
      }
  
      [ActiveRecord("[MessageOfCampaign]")]
      public class MessageOfCampaign : ActiveRecordBase&lt;MessageOfCampaign&gt;
      {
          private MessageOfCampaignKey m_Key;
          [CompositeKey]
          public MessageOfCampaignKey Key
          {
              get { return m_Key; }
              set { m_Key = value; }
          }
  
          private Message m_Message;
          [OneToOne]
          public Message Message
          {
              get { return m_Message; }
              set { m_Message = value; }
          }
  
          private Campaign m_Campaign;
          [BelongsTo("`CampaignID`")]
          public Campaign Campaign
          {
              get { return m_Campaign; }
              set { m_Campaign = value; }
          }
      }
  </code></pre>
  
  <p>Message:</p>
  
  <pre><code>[ActiveRecord("[Message]")]
      public class Message : ActiveRecordBase
      {
          private long m_ID;
          [PrimaryKey(Column = "`ID`")]
          public long ID
          {
              get { return m_ID; }
              set { m_ID = value; }
          }
          //// Properties ...
  
          [OneToOne]
          public MessageOfCampaign MessageOfCampaign
          {
              get { return this.m_MessageOfCampaign; }
              set { this.m_MessageOfCampaign = value; }
          }
       }
  </code></pre>
  
  <p>But I got the error:</p>
  
  <blockquote>
    <p>broken column mapping for:
    MessageOfCampaign.id of:
    IMobileMarketing.Models.Message, type
    component[MessageID,CampaignID]
    expects 2 columns, but 1 were mapped</p>
  </blockquote>