Пример #1
0
        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));
        }
Пример #2
0
        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());
        }