Esempio n. 1
0
        public virtual RelationalTransaction UseTransaction([CanBeNull] DbTransaction transaction)
        {
            if (transaction == null)
            {
                if (Transaction != null)
                {
                    Transaction = null;

                    Close();
                }
            }
            else
            {
                if (Transaction != null)
                {
                    throw new InvalidOperationException(Strings.TransactionAlreadyStarted);
                }

                Open();

                Transaction = new RelationalTransaction(this, transaction, /*transactionOwned*/ false, _logger.Value);
            }

            return(Transaction);
        }
Esempio n. 2
0
        private RelationalTransaction BeginTransactionWithNoPreconditions(IsolationLevel isolationLevel)
        {
            _logger.Value.BeginningTransaction(isolationLevel);

            Transaction = new RelationalTransaction(this, DbConnection.BeginTransaction(isolationLevel), /*transactionOwned*/ true, _logger.Value);

            return(Transaction);
        }
        public virtual RelationalTransaction UseTransaction(DbTransaction transaction)
        {
            if (transaction == null)
            {
                if (Transaction != null)
                {
                    Transaction = null;

                    Close();
                }
            }
            else
            {
                if (Transaction != null)
                {
                    throw new InvalidOperationException(Strings.TransactionAlreadyStarted);
                }

                Open();

                Transaction = new RelationalTransaction(this, transaction, /*transactionOwned*/ false, _logger.Value);
            }

            return Transaction;
        }
        private RelationalTransaction BeginTransactionWithNoPreconditions(IsolationLevel isolationLevel)
        {
            _logger.Value.BeginningTransaction(isolationLevel);

            Transaction = new RelationalTransaction(this, DbConnection.BeginTransaction(isolationLevel), /*transactionOwned*/ true, _logger.Value);

            return Transaction;
        }
        private RelationalTransaction BeginTransactionWithNoPreconditions(IsolationLevel isolationLevel)
        {
            Transaction = new RelationalTransaction(this, DbConnection.BeginTransaction(isolationLevel), transactionOwned: true);

            return(Transaction);
        }