private void MarkOpened() { if (Interlocked.CompareExchange(ref _opened, 1, 0) != 0) { throw ExecutionContextException.ConnectionAlreadyOpen(); } }
public IContextBuilder UseTransaction(IsolationLevel il) { if (IsOpen) { throw ExecutionContextException.ConnectionAlreadyOpen(); } _isolationLevel = il; return(this); }
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); }