title: NHibernate, property implements interface, can we populate from multiple tables?
body: <p>Using NHibernate and Fluent Mappings.</p>
  
  <p>We have a property (Groupable) of a class (GroupAssignment) which implements an interface (IGroupable). Another property on the same class is an enumeration (ItemType) which specifies where the IGroupable is sourced from, i.e. which table.</p>
  
  <p>Can we map this configuration so that NHibernate populates the IGroupable property, linking to the correct table based on the Enum discriminator? If so, how can we achieve this?</p>
  
  <p>Please note the IGroupable property has a one to one relationship with GroupAssignment class.</p>
  
  <pre><code>public class GroupAssignment
  {
      public virtual new long ID { get; private set; }
      public virtual Group Group { get; set; }
      public virtual TypeEnum.TypeGroupItem ItemType { get; set; }
      public virtual IGroupable Groupable { get; set; }
  }
  </code></pre>
  
  <p>Ideally NHibernate should get the IGroupable from<br>
  TableA when ItemType == TableA,<br>
  TableB when ItemType == TableB etc.</p>
  
  <p>I should also add that each of the tables directed by the ItemType enum are mapped to classes which implement the IGroupable interface.</p>