title: EF7 alpha connection state problems
body: <p>I'm trying to use EF in a asp.net vNext SPA application.</p>
  
  <p>I'm registering the context class with the build in dependency injection container using AddScoped() (just like they have it in the examples) but when I try to perform a delete operation on an entity I get weird errors.
  Sometimes the delete works, sometimes I get a </p>
  
  <pre><code>Invalid operation. The connection is closed.
  </code></pre>
  
  <p>and sometimes I get a</p>
  
  <pre><code>The connection was not closed. The connection's current state is open.
  </code></pre>
  
  <p>This only happens for delete operations and I can't find a pattern on when the 'connection is open' and 'connection is closed' appear.</p>
  
  <p>Here's my delete method body (the method is virtual because this is a base controller, though no overrides exist for it yet):</p>
  
  <pre><code>public virtual async Task&lt;IActionResult&gt; Delete(int id)
  {
      var t = await Items.SingleOrDefaultAsync(i =&gt; i.ID == id);
      if (t == null)
          return new HttpStatusCodeResult((int)HttpStatusCode.NoContent);
  
      Items.Remove(t);
      AppContext.SaveChanges();
  
      return new HttpStatusCodeResult((int)HttpStatusCode.OK);
  }
  </code></pre>