title: How to include properties when using inheritance in EF?
body: <p>I'm trying to use inheritance in EF and have come up with the following (simplified):</p>
  
  <pre><code>public abstract class Job
  {
      public int Id { get; set; }
      public DateTime ScheduledTime { get; set; }
  }
  
  [Table("InstallationJobs")]
  public class InstallationJob : Job
  {
      public PbnSite Site { get; set; }
  }
  </code></pre>
  
  <p>And my dbcontext has the following:</p>
  
  <pre><code>public DbSet&lt;Job&gt; Jobs { get; set; }
  </code></pre>
  
  <p>Now, I'm trying to get a random job (which I've previously inserted):</p>
  
  <pre><code>var job = _dbContext.Jobs.OrderBy(x =&gt; x.ScheduledTime).FirstOrDefault();
  //logic to find out which job time was retrieved and then get the specific information
  </code></pre>
  
  <p>And that returns a job! However, when I cast the job to the correct job type (InstallationJob in this example), it doesn't have any information in regards to the Site property. (since I haven't included it). </p>
  
  <p>But how would I go about including it seeing as Jobs is a generic table? </p>
  
  <p>When the job is of childtype X I want to include the properties of X and when it is of Y I want to include the properties of Y.</p>