title: Includes doesn't work with LinqKit AsExpandable
body: <p>I'm trying to use <code>LinqKit</code> <code>AsExpandable</code> in my <code>EfCore2.0</code> project and I am running into this problem where the <code>Includes</code> doesn't work.</p>
  
  <p>In attempting to debug this I have downloaded the <code>LinqKit</code> source from github and have replaced the <code>Nuget</code> references in my project with Project references.</p>
  
  <p>When debugging with the <code>LinqKit</code> project, I noticed that the my call to <code>Include</code> wasn't hitting a breakpoint I set on <code>ExpandableQueryOfClass&lt;T&gt;.Include</code>.</p>
  
  <p>I did some further testing and noticed the breakpoint <em>is</em> hit if I first cast to <code>ExpandableQueryOfClass</code> (this is an internal class in <code>LinqKit</code> which I made public, so I can't do the cast if I'm referencing the <code>Nuget</code> package).</p>
  
  <p>Is this a bug in <code>LinqKit</code> or am I doing something wrong?</p>
  
  <p>Here is my test code.</p>
  
  <pre><code>using System.Linq;
  using System.Threading.Tasks;
  using Microsoft.EntityFrameworkCore;
  
  using Internal.DAL.Db;
  using Internal.Models.Customer;
  
  using LinqKit; // Referencing LinqKit.Microsoft.EntityFrameworkCore
  using Xunit;
  
  namespace Internal.EntityFramework.Tests
  {
      public class UnitTest1
      {
          private DbContextOptionsBuilder&lt;DataContext&gt; _ctxBuilder =&gt;
              new DbContextOptionsBuilder&lt;DataContext&gt;().UseSqlServer(Connection.String);
  
          [Fact]
          public async Task SuccessTest()
          {
              using (var ctx = new DataContext(_ctxBuilder.Options))
              {
                  var query = 
                      (
                          // this cast is the only difference between the methods
                          (ExpandableQueryOfClass&lt;Order&gt;)
                          ctx.Orders
                          .AsExpandable()
                      )
                      .Include(r =&gt; r.Customer)
                      .Take(500);
  
                  var responses = await query.ToListAsync();
  
                  // this succeeds
                  Assert.All(responses, r =&gt; Assert.NotNull(r.Customer));
              }
          }
  
          [Fact]
          public async Task FailTest()
          {
              using (var ctx = new DataContext(_ctxBuilder.Options))
              {
                  var query = ctx.Orders
                      .AsExpandable()
                      .Include(r =&gt; r.Customer)
                      .Take(500);
  
                  var responses = await query.ToListAsync();
  
                  // this fails
                  Assert.All(responses, r =&gt; Assert.NotNull(r.Customer));
              }
          }
      }
  }
  </code></pre>
  
  <p>Edit <code>2018-05-15</code>: There is an <a href="https://github.com/scottksmith95/LINQKit/issues/14" rel="nofollow noreferrer">open issue</a> on the LinqKit github repository.</p>