コード例 #1
0
 void IEnlistmentNotificationInternal.Commit(
     IPromotedEnlistment enlistment
     )
 {
     _promotedEnlistment = enlistment;
     _twoPhaseNotifications.Commit(Enlistment);
 }
コード例 #2
0
        /// <summary>
        /// Tells al participanting resource managers to commit their changes.
        /// </summary>
        internal void Commit()
        {
            if (TransactionInformation.Status != TransactionStatus.Active)
            {
                throw new TransactionException("Cannot commit transaction, as it is not active. Trasnaction Status: " + TransactionInformation.Status);
            }

            PreparingEnlistment     lpeEnlistment   = null;
            IEnlistmentNotification entNotification = null;

            for (Int32 i = m_lstNotifications.Count - 1; i >= 0; i--)
            {
                entNotification = m_lstNotifications[i];
                lpeEnlistment   = new PreparingEnlistment();
                entNotification.Commit(lpeEnlistment);
                if (lpeEnlistment.DoneProcessing)
                {
                    m_lstNotifications.RemoveAt(i);
                }
            }
            if (m_lstNotifications.Count > 0)
            {
                TransactionInformation.Status = TransactionStatus.InDoubt;
                NotifyInDoubt();
            }
            else
            {
                TransactionInformation.Status = TransactionStatus.Committed;
            }
        }