Beispiel #1
0
 private void MarkOpened()
 {
     if (Interlocked.CompareExchange(ref _opened, 1, 0) != 0)
     {
         throw ExecutionContextException.ConnectionAlreadyOpen();
     }
 }
Beispiel #2
0
 public IContextBuilder UseTransaction(IsolationLevel il)
 {
     if (IsOpen)
     {
         throw ExecutionContextException.ConnectionAlreadyOpen();
     }
     _isolationLevel = il;
     return(this);
 }
Beispiel #3
0
        public IDbCommandAsync CreateCommand()
        {
            if (!IsOpen)
            {
                throw ExecutionContextException.ConnectionNotOpen();
            }
            var command = Connection.CreateCommand();

            if (Transaction != null)
            {
                command.Command.Transaction = Transaction;
            }
            // Set this, even though in async contexts it will probably be ignored
            if (_timeoutSeconds > 0)
            {
                command.Command.CommandTimeout = _timeoutSeconds;
            }
            return(command);
        }