Ejemplo n.º 1
0
        public override void Commit()
        {
            base.Commit();

            LogMessage message = new LogMessage("Committing local transaction");
            LogMessage verbose = new LogMessage("Data source: {0}, Auto persist: {1}" , m_DataSource.Name , this.AutoPersistAllOnCommit  );
            this.Context.LogManager.Info(this, message , verbose); // do not localize

            TransactionCancelEventArgs e = new TransactionCancelEventArgs(this, m_DataSource, this.IsolationLevel, this.AutoPersistAllOnCommit);
            this.Context.EventManager.OnCommittingTransaction(this, e);
            if (e.Cancel)
            {
                return;
            }
            this.AutoPersistAllOnCommit = e.AutoPersistAllOnCommit;

            if (this.AutoPersistAllOnCommit)
            {
                this.Context.Commit();
            }
            m_DbTransaction.Commit();
            this.Context.OnTransactionComplete(this);
            m_DataSource.KeepConnectionOpen = m_OriginalKeepOpen;

            m_DataSource.ReturnConnection();

            TransactionEventArgs e2 = new TransactionEventArgs(this, m_DataSource, this.AutoPersistAllOnCommit);
            this.Context.EventManager.OnCommittedTransaction(this, e2);
        }
Ejemplo n.º 2
0
		public virtual void Commit()
		{
			this.Context.LogManager.Info(this, "Committing local transaction", "Data source: " + m_DataSource.Name + ", " + "Auto persist: " + m_AutoPersistAllOnCommit.ToString()  ); // do not localize	

			TransactionCancelEventArgs e = new TransactionCancelEventArgs(this, m_DataSource, this.IsolationLevel, m_AutoPersistAllOnCommit);
			this.Context.EventManager.OnCommittingTransaction(this, e);
			if (e.Cancel)
			{
				return;
			}
			m_AutoPersistAllOnCommit = e.AutoPersistAllOnCommit;			

			if (m_AutoPersistAllOnCommit)
			{
				this.Context.Commit();
			}
			m_DbTransaction.Commit();
			this.Context.OnTransactionComplete(this);
			m_DataSource.KeepConnectionOpen = m_OriginalKeepOpen;

			m_DataSource.ReturnConnection();

			TransactionEventArgs e2 = new TransactionEventArgs(this, m_DataSource, m_AutoPersistAllOnCommit);
			this.Context.EventManager.OnCommittedTransaction(this, e2);
		}
Ejemplo n.º 3
0
 public virtual void OnCommittingTransaction(object sender, TransactionCancelEventArgs e)
 {
 }
Ejemplo n.º 4
0
 public virtual void OnBeginningTransaction(object sender, TransactionCancelEventArgs e)
 {
 }
Ejemplo n.º 5
0
 public virtual void OnRollingbackTransaction(object sender, TransactionCancelEventArgs e)
 {
 }
Ejemplo n.º 6
0
		public virtual void OnRollingbackTransaction(object sender, TransactionCancelEventArgs e)
		{
			if (!(m_RaiseEvents))
			{
				return;
			}
			if (!(m_RaiseBeforeEvents))
			{
				return;
			}
			if (!(m_RaiseTransactionEvents))
			{
				return;
			}
			foreach (IObserver observer in m_Observers)
			{
				observer.OnRollingbackTransaction(sender, e);
			}
			foreach (IObserver observer in m_ContextObservers)
			{
				observer.OnRollingbackTransaction(sender, e);
			}
			this.Observer.OnRollingbackTransaction(sender, e);
		}