Example #1
0
 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;
     }
 }