private async Task CloseImpl(AsyncWrappingCommonArgs async) { if (!IsClosed) { _isClosed = true; if (_command != null && !_command.IsDisposed) { if (_command.CommandType == CommandType.StoredProcedure) { await _command.SetOutputParameters(async).ConfigureAwait(false); } if (_command.HasImplicitTransaction) { await _command.CommitImplicitTransaction(async).ConfigureAwait(false); } _command.ActiveReader = null; } if (_connection != null && IsCommandBehavior(CommandBehavior.CloseConnection)) { await _connection.CloseImpl(async).ConfigureAwait(false); } _position = StartPosition; _command = null; _connection = null; _row = null; _schemaTable = null; _fields = null; } }
protected override void Dispose(bool disposing) { if (disposing) { if (!IsClosed) { _isClosed = true; if (_command != null && !_command.IsDisposed) { if (_command.CommandType == CommandType.StoredProcedure) { _command.SetOutputParameters(); } if (_command.HasImplicitTransaction) { _command.CommitImplicitTransaction(); } _command.ActiveReader = null; } if (_connection != null && IsCommandBehavior(CommandBehavior.CloseConnection)) { _connection.Close(); } _position = StartPosition; _command = null; _connection = null; _row = null; #if !NETSTANDARD1_6 _schemaTable = null; #endif _fields = null; } } }
protected override void Dispose(bool disposing) { if (disposing) { if (!IsClosed) { try { if (_command != null && !_command.IsDisposed) { if (_command.CommandType == CommandType.StoredProcedure) { // Set values of output parameters _command.SetOutputParameters(); } if (_command.HasImplicitTransaction) { // Commit implicit transaction if needed _command.CommitImplicitTransaction(); } // Set null the active reader of the command _command.ActiveReader = null; } } finally { if (_connection != null && IsCommandBehavior(CommandBehavior.CloseConnection)) { _connection.Close(); } _isClosed = true; _position = STARTPOS; _command = null; _connection = null; _row = null; #if !NETCORE10 _schemaTable = null; #endif _fields = null; } } } }