コード例 #1
0
        public void InDoubt( Enlistment enlistment )
        {
            Status = TxfmStatus.InInDoubt;

            enlistment.Done();

            Status = TxfmStatus.InTransaction;
        }
コード例 #2
0
        /// <summary>
        /// Notifies an enlisted object that a transaction is being prepared for commitment.
        /// </summary>
        /// <param name="preparingEnlistment">A <see cref="T:System.Transactions.PreparingEnlistment"/> object used to send a response to the transaction manager.</param>
        public void Prepare( PreparingEnlistment preparingEnlistment )
        {
            Status = TxfmStatus.InPrepare;

            // TODO: Write to recovery log.

            foreach( var operation in operations )
            {
                operation.Commit();
            }

            preparingEnlistment.Prepared();

            Status = TxfmStatus.InTransaction;
        }
コード例 #3
0
        /// <summary>
        /// Notifies an enlisted object that a transaction is being committed.
        /// </summary>
        /// <param name="enlistment">An <see cref="T:System.Transactions.Enlistment"/> object used to send a response to the transaction manager.</param>
        public void Commit( Enlistment enlistment )
        {
            Status = TxfmStatus.InCommit;

            // TODO: Remove recovery log.

            foreach( var operation in operations )
            {
                operation.Commit();
            }

            enlistment.Done();

            Status = TxfmStatus.None;
        }
コード例 #4
0
        /// <summary>
        /// Notifies an enlisted object that a transaction is being rolled back (aborted).
        /// </summary>
        /// <param name="enlistment">A <see cref="T:System.Transactions.Enlistment"/> object used to send a response to the transaction manager.</param>
        public void Rollback( Enlistment enlistment )
        {
            Status = TxfmStatus.InRollback;

            // TODO: Remove recovery log.

            for( var i = operations.Count - 1; i >= 0; i-- )
            {
                operations[i].Rollback();
            }

            enlistment.Done();

            Status = TxfmStatus.None;
        }