title: Using async with Entity Framework select list of type IQueryable<T>
body: <p>I'm trying to convert data access synchronous query to asynchronous, so far I converted everything except selecting list which returns <code>IQueryable&lt;T&gt;</code>. </p>
  
  <p>Here's what I have done so far:</p>
  
  <pre><code>    [Dependency]
      public SampleContext db { get; set; }
  
      public async System.Threading.Tasks.Task&lt;Profile&gt; Add(Profile item)
      {
          db.Profiles.Add(item);
          await db.SaveChangesAsync();
          return item;
      }
  
      public async System.Threading.Tasks.Task&lt;Profile&gt; Get(string id)
      {
          return await db.Profiles.AsNoTracking().Where(i =&gt; i.Id == id).FirstOrDefaultAsync();
      }
  
      public async System.Threading.Tasks.Task Remove(string id)
      {
          Profile item = db.Profiles.Find(id);
          item.IsDeleted = 1;
          db.Entry(item).State = EntityState.Modified;
          await db.SaveChangesAsync();
      }
  
      public async System.Threading.Tasks.Task&lt;bool&gt; Update(Profile item)
      {
          db.Set&lt;Profile&gt;().AddOrUpdate(item);
          await db.SaveChangesAsync();
          return true;
      }
  </code></pre>
  
  <p>Above code works well, I'm stuck at converting this piece of code:</p>
  
  <pre><code>    public IQueryable&lt;Profile&gt; GetAll()
      {
          return db.Profiles.AsNoTracking().Where(i =&gt; i.IsDeleted == 0);
      }
  </code></pre>
  
  <p>How do I convert above code to asynchronous? I tried <a href="https://stackoverflow.com/a/35016869/1386991">this sample code</a> by Stephen Cleary but can't figure out what is <code>ProcessEventAsync</code> and how do I apply this to my code. Also, I can't use <code>.ToList()</code>, this will be too expensive to load all the data in memory.</p>