title: when to dispose db in asp.net async
body: <p>I was looking around but couldn't find anything specific for this one. So, I have an async repository, which used to look like:</p>
  
  <pre><code>public object get()
  {
     var db = new entity(); //i am using EF6
     var listOfObjects = db.Object.ToList();
     db.Dispose();
     return listOfObjects;
  }
  </code></pre>
  
  <p>but now that I'm using async I can't have the dispose there because it hits it before the previous call is being resolved. So my previous method now looks like:</p>
  
  <pre><code>public async Task&lt;Object&gt; GetAsync()
  {
     var db = new entity();
     return await db.Object.ToListAsync();
  }
  </code></pre>
  
  <p>So my question is, when or how should I dispose now?</p>