Exemple #1
0
        public FbTransaction BeginTransaction(FbTransactionOptions options, string transactionName)
        {
            EnsureActiveTransaction();

            try
            {
                _activeTransaction = new FbTransaction(_owningConnection, IsolationLevel.Unspecified);
                _activeTransaction.BeginTransaction(options);

                if (transactionName != null)
                {
                    _activeTransaction.Save(transactionName);
                }
            }
            catch (IscException ex)
            {
                DisposeTransaction();
                throw FbException.Create(ex);
            }

            return(_activeTransaction);
        }
        public FbTransaction BeginTransaction(IsolationLevel level, string transactionName)
        {
            EnsureActiveTransaction();

            try
            {
                _activeTransaction = new FbTransaction(_owningConnection, level);
                _activeTransaction.BeginTransaction();

                if (transactionName != null)
                {
                    _activeTransaction.Save(transactionName);
                }
            }
            catch (IscException ex)
            {
                DisposeTransaction();
                throw new FbException(ex.Message, ex);
            }

            return(_activeTransaction);
        }
Exemple #3
0
        public async Task <FbTransaction> BeginTransactionAsync(FbTransactionOptions options, string transactionName, CancellationToken cancellationToken = default)
        {
            EnsureActiveTransaction();

            try
            {
                _activeTransaction = new FbTransaction(_owningConnection, IsolationLevel.Unspecified);
                await _activeTransaction.BeginTransactionAsync(options, cancellationToken).ConfigureAwait(false);

                if (transactionName != null)
                {
                    _activeTransaction.Save(transactionName);
                }
            }
            catch (IscException ex)
            {
                await DisposeTransactionAsync(cancellationToken).ConfigureAwait(false);

                throw FbException.Create(ex);
            }

            return(_activeTransaction);
        }
Exemple #4
0
        public async Task <FbTransaction> BeginTransaction(FbTransactionOptions options, string transactionName, AsyncWrappingCommonArgs async)
        {
            EnsureActiveTransaction();

            try
            {
                _activeTransaction = new FbTransaction(_owningConnection, IsolationLevel.Unspecified);
                await _activeTransaction.BeginTransaction(options, async).ConfigureAwait(false);

                if (transactionName != null)
                {
                    _activeTransaction.Save(transactionName);
                }
            }
            catch (IscException ex)
            {
                await DisposeTransaction(async).ConfigureAwait(false);

                throw new FbException(ex.Message, ex);
            }

            return(_activeTransaction);
        }
Exemple #5
0
        public async Task <FbTransaction> BeginTransaction(IsolationLevel level, string transactionName, AsyncWrappingCommonArgs async)
        {
            EnsureActiveTransaction();

            try
            {
                _activeTransaction = new FbTransaction(_owningConnection, level);
                await _activeTransaction.BeginTransaction(async).ConfigureAwait(false);

                if (transactionName != null)
                {
                    _activeTransaction.Save(transactionName);
                }
            }
            catch (IscException ex)
            {
                await DisposeTransaction(async).ConfigureAwait(false);

                throw FbException.Create(ex);
            }

            return(_activeTransaction);
        }
Exemple #6
0
        public FbTransaction BeginTransaction(IsolationLevel level, string transactionName)
        {
            if (HasActiveTransaction)
            {
                throw new InvalidOperationException("A transaction is currently active. Parallel transactions are not supported.");
            }

            try
            {
                _activeTransaction = new FbTransaction(_owningConnection, level);
                _activeTransaction.BeginTransaction();

                if (transactionName != null)
                {
                    _activeTransaction.Save(transactionName);
                }
            }
            catch (IscException ex)
            {
                throw new FbException(ex.Message, ex);
            }

            return(_activeTransaction);
        }
		public FbTransaction BeginTransaction(FbTransactionOptions options, string transactionName)
		{
			lock (this)
			{
				if (HasActiveTransaction)
				{
					throw new InvalidOperationException("A transaction is currently active. Parallel transactions are not supported.");
				}

				try
				{
					_activeTransaction = new FbTransaction(
						_owningConnection, IsolationLevel.Unspecified);

					_activeTransaction.BeginTransaction(options);

					if (transactionName != null)
					{
						_activeTransaction.Save(transactionName);
					}
				}
				catch (IscException ex)
				{
					throw new FbException(ex.Message, ex);
				}
			}

			return _activeTransaction;
		}