title: Multiple Includes() in EF Core
body: <p>I have an extension method that lets you generically include data in EF:</p>
  
  <pre><code>public static IQueryable&lt;T&gt; IncludeMultiple&lt;T&gt;(this IQueryable&lt;T&gt; query, params Expression&lt;Func&lt;T, object&gt;&gt;[] includes)
      where T : class
  {
      if (includes != null)
      {
          query = includes.Aggregate(query, (current, include) =&gt; current.Include(include));
      }
      return query;
  }
  </code></pre>
  
  <p>This allows me to have methods in my repository like this:</p>
  
  <pre><code>public Patient GetById(int id, params Expression&lt;Func&lt;Patient, object&gt;&gt;[] includes)
  {
      return context.Patients
          .IncludeMultiple(includes)
          .FirstOrDefault(x =&gt; x.PatientId == id);
  }
  </code></pre>
  
  <p>I believe the extension method worked before EF Core, but now including "children" is done like this:</p>
  
  <pre><code>var blogs = context.Blogs
      .Include(blog =&gt; blog.Posts)
          .ThenInclude(post =&gt; post.Author);
  </code></pre>
  
  <p>Is there a way to alter my generic extension method to support EF Core's new <code>ThenInclude()</code> practice?</p>