public virtual async Task <object?> ExecuteScalarAsync(UntypedQuery query, DbConnection connection, DbTransaction?transaction, CancellationToken cancellationToken) { Check.NotNull(query, nameof(query)); Check.NotNull(connection, nameof(connection)); using var command = connection.CreateCommand(); command.Transaction = transaction; query.SetupCommand(command); return(await command.ExecuteScalarAsync(cancellationToken).ConfigureAwait(false)); }
public virtual object ExecuteScalar(UntypedQuery query, DbConnection connection, DbTransaction?transaction) { Check.NotNull(query, nameof(query)); Check.NotNull(connection, nameof(connection)); using var command = connection.CreateCommand(); command.Transaction = transaction; query.SetupCommand(command); return(command.ExecuteScalar()); }