Exemple #1
0
        public override async Task CloseAsync()
#endif
        {
            if (!IsClosed)
            {
                _isClosed = true;
                if (_command != null && !_command.IsDisposed)
                {
                    if (_command.CommandType == CommandType.StoredProcedure)
                    {
                        await _command.SetOutputParametersAsync(CancellationToken.None).ConfigureAwait(false);
                    }
                    if (_command.HasImplicitTransaction)
                    {
                        await _command.CommitImplicitTransactionAsync(CancellationToken.None).ConfigureAwait(false);
                    }
                    _command.ActiveReader = null;
                }
                if (_connection != null && IsCommandBehavior(CommandBehavior.CloseConnection))
                {
                    await _connection.CloseAsync().ConfigureAwait(false);
                }
                _position    = StartPosition;
                _command     = null;
                _connection  = null;
                _row         = null;
                _schemaTable = null;
                _fields      = null;
            }
        }