title: DbCommand and connection - why does dispose not close underlying connection?
body: <p>I've seen this in some legacy code which generates code analysis warnings:</p>
  
  <pre><code>  Database db = DatabaseFactory.CreateDatabase(strDBCon);
    DbCommand dbCommand = db.GetSqlStringCommand(sb.ToString());
  
    using (IDataReader dataReader = db.ExecuteReader(dbCommand))
    {
       while (dataReader.Read())
       {
       }
       dataReader.Close();  // &lt;-- this is redundant as close is covered by using's implicit dispose
    }
    dbCommand.Connection.Close();
    dbCommand.Dispose();
    db = null;
  </code></pre>
  
  <p>I've read here on SO that the dbCommand.Connection property must be closed in addition to disposing of the dbCommand.  I would have thought that dbCommand would dispose of any child disposable objects, in this case Connection.  If this is not the case, why?</p>