System.Data.Common.DbDataAdapter.QuietClose C# (CSharp) Method

QuietClose() private static method

private static QuietClose ( IDbConnection connection, ConnectionState originalState ) : void
connection IDbConnection
originalState ConnectionState
return void
        private static void QuietClose(IDbConnection connection, ConnectionState originalState)
        {
            // close the connection if:
            // * it was closed on first use and adapter has opened it, AND
            // * provider's implementation did not ask to keep this connection open
            if ((null != connection) && (ConnectionState.Closed == originalState))
            {
                // we don't have to check the current connection state because
                // it is supposed to be safe to call Close multiple times
                connection.Close();
            }
        }