title: EF DBContext dispose not closing the connection
body: <p>I am using the EF 6.1.0</p>
  
  <p>I have below custom DBContex object as DBEntites </p>
  
  <pre><code>public partial class DbEntities : DbContext
  {
      public DbEntities()
          : base("name=DbEntities")
      {
          ////Configuration.LazyLoadingEnabled = true;
          ////Configuration.ProxyCreationEnabled = false;
      }
  
      //// I have ALL Entites added as below
      ////public virtual IDbSet&lt;CCode&gt; CCodes { get; set; }
  }
  </code></pre>
  
  <p>I have the below operations on context object</p>
  
  <pre><code>using (var context = new DbEntities())
          {
              var entitySet = context.Set&lt;T&gt;();
              var res = entitySet.Where&lt;T&gt;(predicate).ToList();
              if (context.Database.Connection.State == ConnectionState.Open)
              {
                  context.Database.Connection.Close();
              }
  
              return res;
          }
  </code></pre>
  
  <p>But after disposing the context object still i can see a active DB Connection. On connection state condition i can see that the connection is already closed(the connection had never true).</p>
  
  <p>I am using the below query to see the connection on SQL.</p>
  
  <pre><code>select db_name(dbid) , count(*) 'connections count'
  from master..sysprocesses
  where spid &gt; 50 and spid != @@spid
  group by db_name(dbid)
  order by count(*) desc
  </code></pre>
  
  <p>At the below statement a sql connection count increased. But it was never down even after disposing . (I mean after using block excuted it supposed to close the connection).</p>
  
  <pre><code>var res = entitySet.Where&lt;T&gt;(predicate).ToList();
  </code></pre>
  
  <p>Any help would be greatly appreciated.</p>