title: Combine two classes from a table per hierarchy inheritance structure in Entity Framework
body: <p>We're are using the table per hierarchy inheritance technique with Entity Framework.
  I'll take the example classes from this page as the basic classes: <a href="https://www.learnentityframeworkcore.com/inheritance/table-per-hierarchy" rel="nofollow noreferrer">Table per Hierarchy Inheritance - The Model</a>. Please don't take the class names and properties as set. I didn't want to expose anything critical. This question is just about the structure.</p>
  <pre><code>public class Contract
  {
      public int ContractId { get; set; }
      public DateTime StartDate { get; set; }
      public int Months { get; set;}
      public decimal Charge { get; set; }
  }
  
  public class MobileContract : Contract
  {
      public string MobileNumber { get; set; }
  }
  
  public class TvContract : Contract
  {
      public PackageType PackageType { get; set; }
  }
  
  public class BroadBandContract : Contract
  {
      public int DownloadSpeed { get; set; }
  }
  
  public enum PackageType
  {
      S, M, L, XL
  }
  </code></pre>
  <p>Now, in our case we have the situation that there is a contract that can be both, a <code>TvContract</code> and a <code>BroadBandContract</code>, e.g. a <code>MultiContract</code>. We don't know how to deal with this since we cannot inherit from two classes.
  If we query the <code>DbSet&lt;TvContract&gt;</code> or <code>DbSet&lt;BroadBandContract&gt;</code> from the  we also want to get the <code>MultiContract</code>s.</p>
  <p>Does someone have an idea how to deal with this scenario?</p>