title: ToListAsync in ASP.NET MVC Core and Entity Framework not working
body: <p>I have the following code in ASP.NET MVC Core and Entity Framework and I get the following error when I do a <code>ToListAsync</code>.</p>
  
  <blockquote>
    <p>Additional information: The source IQueryable doesn't implement
    IDbAsyncEnumerable. Only sources
    that implement IDbAsyncEnumerable can be used for Entity Framework
    asynchronous operations. For more details see
    <a href="http://go.microsoft.com/fwlink/?LinkId=287068" rel="noreferrer">http://go.microsoft.com/fwlink/?LinkId=287068</a>.</p>
  </blockquote>
  
  <p>This is my code:</p>
  
  <pre><code>var states = mDbContext.State.ToListAsync();
  var countries = mDbContext.Country.ToListAsync();
  
  mMemoryCache.Set(Countries, await countries,
      new MemoryCacheEntryOptions().SetAbsoluteExpiration(TimeSpan.MaxValue));
  mMemoryCache.Set(States, await states,
     new MemoryCacheEntryOptions().SetAbsoluteExpiration(TimeSpan.MaxValue));
  </code></pre>
  
  <p>My context class extends from <code>DbContext</code>, and I used EF 6.</p>
  
  <pre><code>public virtual DbSet&lt;Country&gt; Country { get; set; }
  
  public virtual DbSet&lt;State&gt; State { get; set; }
  </code></pre>
  
  <p>Any idea why I can't perform <code>ToListAsync()</code> even when I have everything installed?</p>