title: Mapping interface on multiple hierarchies with NHibernate
body: <p>Given 2 classes that are not related, one of which is a member of 
  another inheritance hierarchy, how can I map an interface on both of 
  the classes so that I can query against the interface and have the 
  appropriate concrete type returned? 
  E.g. </p>
  
  <pre><code>public abstract class Survey 
  { 
      public Guid Id { get; private set; } 
  } 
  
  public class InviteOnlySurvey : Survey 
  { 
      public ICollection&lt;Invite&gt; Invites { get; private set; } 
  } 
  
  public class Invite : ISurveyGateway 
  { 
      public Guid Id { get; private set; } 
      public InviteOnlySurvey Survey { get; private set; } 
  } 
  
  public class SharedSurvey : Survey, ISurveyGateway { ... } 
  
  public interface ISurveyGateway 
  { 
      Guid Id { get; } 
  } 
  </code></pre>
  
  <p>Currently I have mapped Survey, InviteOnlyLiveSurvey and SharedLiveSurvey using table per class hierarchy and now I am trying to figure out how to map ISurveyGateway so that I can query against it and have NHibernate find the matching entity ( Invite or 
  SharedLiveSurvey ) seamlessly.  ISurveyGateway instances are effectively readonly as all the remaining persistence concerns are managed through the mappings for SharedSurvey and Invite.</p>
  
  <p>If I remove the ISurveyGateway interface from either SharedSurvey or Invite, I can query and retrieve ISurveyGateway instances via NHibernate, but as soon as I apply the interface to 2 different hierarchies I get an exception with the message "Ambiguous persister for ISurveyGateway implemented by more than one hierarchy" (which is expected - I just don't know how to make it work).</p>