Example #1
0
 public Task <IStatementResultCursor> RunAsync(Statement statement, TransactionConfig txConfig)
 {
     return(TryExecuteAsync(_logger, async() =>
     {
         await EnsureCanRunMoreStatementsAsync().ConfigureAwait(false);
         _connection = await _connectionProvider.AcquireAsync(_defaultMode).ConfigureAwait(false);
         var protocol = _connection.BoltProtocol;
         return await protocol.RunInAutoCommitTransactionAsync(_connection, statement, this, _bookmark, txConfig).ConfigureAwait(false);
     }));
 }
Example #2
0
        public override Task <IStatementResultCursor> RunAsync(Statement statement)
        {
            return(TryExecuteAsync(async() =>
            {
                await EnsureCanRunMoreStatementsAsync().ConfigureAwait(false);

                _connection = await _connectionProvider.AcquireAsync(_defaultMode).ConfigureAwait(false);
                var resultBuilder = new ResultCursorBuilder(statement.Text, statement.Parameters,
                                                            () => _connection.ReceiveOneAsync(), _connection.Server, this);
                _connection.Run(statement.Text, statement.Parameters, resultBuilder);

                await _connection.SendAsync().ConfigureAwait(false);

                return await resultBuilder.PreBuildAsync().ConfigureAwait(false);
            }));
        }
        private async Task AcquireConnectionAndDBName(AccessMode mode)
        {
            _connection = await _connectionProvider.AcquireAsync(mode, _database, ImpersonatedUser(), _bookmark).ConfigureAwait(false);

            //Update the database. If a routing request occured it may have returned a differing DB alias name that needs to be used for the
            //rest of the sessions lifetime.
            _database = _connection.Database;
        }
        public Task <IStatementResultCursor> RunAsync(Statement statement, Action <TransactionConfigBuilder> action)
        {
            var options = BuildTransactionConfig(action);
            var result  = TryExecuteAsync(_logger, async() =>
            {
                await EnsureCanRunMoreStatementsAsync().ConfigureAwait(false);
                _connection = await _connectionProvider.AcquireAsync(_defaultMode, _database, _bookmark)
                              .ConfigureAwait(false);
                var protocol = _connection.BoltProtocol;
                return(await protocol
                       .RunInAutoCommitTransactionAsync(_connection, statement, _reactive, this, this, _database,
                                                        _bookmark, options, _fetchSize)
                       .ConfigureAwait(false));
            });

            _result = result;
            return(result);
        }