public async Task ExecuteAsync(ICommandAsync command) { if (this.externalTransactionScope != null) { using (var connection = await this.connectionFactory.GetOpenConnectionAsync()) { await command.ExecuteAsync(connection); } } else { using (var transactionScope = new TransactionScope(TransactionScopeOption.Required)) { using (var connection = await this.connectionFactory.GetOpenConnectionAsync()) { await command.ExecuteAsync(connection); } transactionScope.Complete(); } } }
public async Task <T> ExecuteAsync <T>(ICommandAsync <T> command) { if (this.externalTransactionScope != null) { using (var connection = await this.connectionFactory.GetOpenConnectionAsync()) { T result = await command.ExecuteAsync(connection); return(result); } } using (var transactionScope = new TransactionScope(TransactionScopeOption.Required)) { using (var connection = await this.connectionFactory.GetOpenConnectionAsync()) { T result = await command.ExecuteAsync(connection); transactionScope.Complete(); return(result); } } }
/// <summary> /// Executes a prebuilt <see cref="ICommandAsync" /> /// </summary> /// <param name="commandAsync">The command asynchronous.</param> /// <returns>Task<System.Int32>.</returns> public virtual async Task <int> ExecuteAsync(ICommandAsync commandAsync) { return(await commandAsync.ExecuteAsync(Executor)); }
public static async Task ExecuteAsync(this CloudTable table, ICommandAsync <CloudTable> command) { await command.ExecuteAsync(table); }
protected async Task<bool> ExecuteAsync(ICommandAsync cmd) { return await cmd.ExecuteAsync(_eventHandler); }
public bool Execute(ICommandAsync cmd) { return cmd.ExecuteAsync(_eventHandler).Result; }