/// <summary> /// Completes the transaction. /// </summary> /// <remarks> /// This method gets votes from all the participants on whether or not the transaction should be committed. /// </remarks> public void Complete() { if (m_booCompleted) { throw new TransactionException("Complete has already been called."); } if (m_trnTransaction.TransactionInformation.Status == TransactionStatus.Aborted) { throw new TransactionAbortedException("Cannot complete a transaction scope when transaction has already been aborted."); } if (m_booOwnsTransaction) { bool booVotedToCommit = false; booVotedToCommit = m_trnTransaction.Prepare(); if (booVotedToCommit && (m_trnTransaction.TransactionInformation.Status == TransactionStatus.Active)) { m_trnTransaction.Commit(); } } m_booCompleted = true; }