src/Projac.Sql/Executors/ConnectedSqlCommandExecutor.cs
/// <summary>
///     Executes the specified commands asynchronously.
/// </summary>
/// <param name="commands">The commands.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>
///     A <see cref="Task" /> that will return the number of <see cref="SqlNonQueryCommand">commands</see>
///     executed.
/// </returns>
/// <exception cref="System.ArgumentNullException">Thrown when <paramref name="commands" /> are <c>null</c>.</exception>
Executes the specified commands asynchronously.
Executes the specified commands asynchronously .
public async Task<int> ExecuteNonQueryAsync(IEnumerable<SqlNonQueryCommand> commands, CancellationToken cancellationToken)
        {
            if (commands == null) 
                throw new ArgumentNullException("commands");
            var count = 0;
            using (var dbCommand = _dbConnection.CreateCommand())
            {
                dbCommand.Connection = _dbConnection;
                dbCommand.CommandTimeout = _commandTimeout;
                foreach (var command in commands)
                {
                    dbCommand.CommandType = command.Type;
                    dbCommand.CommandText = command.Text;
                    dbCommand.Parameters.Clear();
                    dbCommand.Parameters.AddRange(command.Parameters);
                    await dbCommand.ExecuteNonQueryAsync(cancellationToken);
                    count++;
                }
            }
            return count;
        }
public async Task < int > ExecuteNonQueryAsync ( IEnumerable < SqlNonQueryCommand > commands , CancellationToken cancellationToken ) { if ( commands == null ) throw new ArgumentNullException ( " " ) ; var count = 0 ; using ( var dbCommand = _dbConnection . CreateCommand ( ) ) { dbCommand . Connection = _dbConnection ; dbCommand . CommandTimeout = _commandTimeout ; foreach ( var command in commands ) { dbCommand . CommandType = command . Type ; dbCommand . CommandText = command . Text ; dbCommand . Parameters . Clear ( ) ; dbCommand . Parameters . AddRange ( command . Parameters ) ; await dbCommand . ExecuteNonQueryAsync ( cancellationToken ) ; count ++ ; } } return count ; }
Executes the specified commands asynchronously.
Executes the specified commands asynchronously .
A  that will return the number of commands
A that will return the number of commands
Thrown when  are null
Thrown when are null
commands
IEnumerable<SqlNonQueryCommand>
None
cancellationToken
CancellationToken
The cancellation token.
The cancellation token .