Nexus.Transactions.TransactionScope.Complete C# (CSharp) Method

Complete() public method

Completes the transaction.
This method gets votes from all the participants on whether or not the transaction should be committed.
public Complete ( ) : void
return void
		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;
		}

Usage Example

Ejemplo n.º 1
0
		/// <summary>
		/// Called to perform the upgrade.
		/// </summary>
		/// <remarks>
		/// Sets up the resources required to upgrade the install log.
		/// </remarks>
		/// <param name="p_mdrManagedModRegistry">The <see cref="ModRegistry"/> that contains the list
		/// of managed mods.</param>
		/// <param name="p_strModInstallDirectory">The path of the directory where all of the mods are installed.</param>
		/// <param name="p_strLogPath">The path from which to load the install log information.</param>
		public void Upgrade(string p_strLogPath, string p_strModInstallDirectory, ModRegistry p_mdrManagedModRegistry)
		{
			Trace.WriteLine("Beginning Install Log Upgrade.");

			m_tfmFileManager = new TxFileManager();
			using (TransactionScope tsTransaction = new TransactionScope())
			{
				m_tfmFileManager.Snapshot(p_strLogPath);
				Start(p_strLogPath, p_strModInstallDirectory, p_mdrManagedModRegistry);
				tsTransaction.Complete();
				m_tfmFileManager = null;
			}
		}
All Usage Examples Of Nexus.Transactions.TransactionScope::Complete