Example #1
0
    public static Task ExecuteAsync(this IDbCommandAsyncExecutor executor, ExecuteNonReaderRequest request, Func <DbCommand, Task> execute)
    {
        var requests = new[]
        {
            new ExecuteCommandAsyncRequest(request.CreateCommandRequest, execute)
        };

        return(executor.ExecuteAsync(requests, request.CancellationToken));
    }
Example #2
0
    public static async Task <object> ExecuteScalarAsync(this IDbCommandAsyncExecutor executor, ExecuteNonReaderRequest request)
    {
        object scalar = null;
        await executor.ExecuteAsync(
            request,
            async command => scalar = await command.ExecuteScalarAsync(request.CancellationToken));

        return(scalar);
    }
Example #3
0
    public static async Task <int> ExecuteNonQueryAsync(this IDbCommandAsyncExecutor executor, ExecuteNonReaderRequest request)
    {
        var affectedRows = 0;
        await executor.ExecuteAsync(
            request,
            async command => affectedRows = await command.ExecuteNonQueryAsync(request.CancellationToken));

        return(affectedRows);
    }