会使用块关闭数据库连接?

问题描述:

using (DbConnection conn = new DbConnection())
{
    // do stuff with database
}

请问使用块调用 conn.Close()

是的,它会; DbConnection.Dispose的实现()要求关闭()(所以做它的派生实现)。

Yes, it will; the implementation of DbConnection.Dispose() calls Close() (and so do its derived implementations).