Esempio n. 1
0
 public void BeginChange()
 {
     if (bulkChangesStarted++ == 0)
     {
         TransactionBegan?.Invoke();
     }
 }
Esempio n. 2
0
        public DbTransaction BeginTransaction(IsolationLevel isolationLevel)
        {
            var operationId = Guid.Empty;

            try
            {
                operationId = _diagnosticListener.WriteDbSessionBeginTransactionBefore(this);
                #region Impl
                if (_logger.IsEnabled(LogLevel.Debug))
                {
                    _logger.LogDebug("BeginTransaction.");
                }
                Open();
                Transaction = Connection.BeginTransaction(isolationLevel);
                TransactionBegan?.Invoke(this, DbSessionEventArgs.None);
                #endregion
                _diagnosticListener.WriteDbSessionBeginTransactionAfter(operationId, this);
                return(Transaction);
            }
            catch (Exception ex)
            {
                _diagnosticListener.WriteDbSessionBeginTransactionError(operationId, this, ex);
                throw;
            }
        }
Esempio n. 3
0
        public void BeginTransaction()
        {
            var operationId = Guid.Empty;

            try
            {
                operationId = _diagnosticListener.WriteDbSessionBeginTransactionBefore(this);
                #region Impl
                if (_logger.IsEnabled(LogLevel.Debug))
                {
                    _logger.LogDebug("BeginTransaction.");
                }
                EnsureDataSource();
                Open();
                Transaction = Connection.BeginTransaction();
                TransactionBegan?.Invoke(this, DbSessionEventArgs.None);
                #endregion
                _diagnosticListener.WriteDbSessionBeginTransactionAfter(operationId, this);
            }
            catch (Exception ex)
            {
                _diagnosticListener.WriteDbSessionBeginTransactionError(operationId, this, ex);
                throw ex;
            }
        }
Esempio n. 4
0
        public void BeginTransaction(TransactionScope scope, int objectId = -1, int subIdx = -1, TransactionFlags flags = TransactionFlags.None)
        {
            Debug.Assert(transactions.Count == 0 || transactions.Last().IsEnded);

            if (index != transactions.Count)
            {
                transactions.RemoveRange(index, transactions.Count - index);
            }

            var trans = new Transaction(project, app, scope, flags, objectId, subIdx);

            transactions.Add(trans);
            trans.Begin();
            index++;
            TransactionBegan?.Invoke(scope, flags);
            project.Validate();
        }