title: How to get mapping for key-property in NHibernate?
body: <p>I'm trying to load nhibernate mapping for POCO classes at runtime with following lines:</p>
  
  <pre><code>var persistentClass = NHibernateHelper.Configuration.GetClassMapping( type );
  var property = persistentClass.GetProperty( propertyName );
  </code></pre>
  
  <p>It works fine except it fails on property GroupId on a class with following mapping:</p>
  
  <pre><code>&lt;class name="GroupPartnerInterest" table="[GROUP_PARTNER_INTERESTS]"&gt;
    &lt;composite-id &gt;
      &lt;key-property name="GroupId" column="PAR_ID" /&gt;
  </code></pre>
  
  <p>If <code>type == typeof(GroupPartnerInterest)</code>  <code>persistentClass.GetProperty( "GroupId" )</code> fails with MappingException:</p>
  
  <blockquote>
    <p>property not found: GroupId on entity
    GroupPartnerInterest"</p>
  </blockquote>
  
  <p>I can see in debugger that <code>key-properties</code> from <code>composite-id</code> do not appear in persistentClass.properties.</p>
  
  <p>Is there a way to get mapping for this key-property? </p>
  
  <p>Thank you in advance.</p>