當前位置: 首頁>>代碼示例>>C#>>正文


C# Transactions.SinglePhaseEnlistment類代碼示例

本文整理匯總了C#中System.Transactions.SinglePhaseEnlistment的典型用法代碼示例。如果您正苦於以下問題:C# SinglePhaseEnlistment類的具體用法?C# SinglePhaseEnlistment怎麽用?C# SinglePhaseEnlistment使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


SinglePhaseEnlistment類屬於System.Transactions命名空間,在下文中一共展示了SinglePhaseEnlistment類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: SinglePhaseCommit

 public void SinglePhaseCommit(SinglePhaseEnlistment en)
 {
     if (en == null)
     {
         throw new ArgumentNullException("en");
     }
     try
     {
         this.handle.WaitOne();
     }
     catch (ObjectDisposedException)
     {
     }
     lock (this.syncRoot)
     {
         try
         {
             this.transaction.Commit();
             en.Committed();
         }
         catch (Exception exception)
         {
             en.Aborted(exception);
         }
         finally
         {
             if ((this.connection != null) && (this.connection.State != ConnectionState.Closed))
             {
                 this.connection.Close();
                 this.connection = null;
             }
         }
     }
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:34,代碼來源:LocalTransaction.cs

示例2: Rollback

 public void Rollback(SinglePhaseEnlistment en)
 {
     if (en == null)
     {
         throw new ArgumentNullException("en");
     }
     try
     {
         this.handle.WaitOne();
     }
     catch (ObjectDisposedException)
     {
     }
     lock (this.syncRoot)
     {
         if (this.transaction != null)
         {
             this.transaction.Dispose();
         }
         if ((this.connection != null) && (this.connection.State != ConnectionState.Closed))
         {
             this.connection.Close();
             this.connection = null;
         }
         en.Aborted();
     }
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:27,代碼來源:LocalTransaction.cs

示例3: SinglePhaseCommit

		/// <summary>
		/// Notifies an enlisted object that the transaction is being committed.
		/// </summary>
		/// <param name="singlePhaseEnlistment">A <see cref="T:System.Transactions.SinglePhaseEnlistment"/> interface used to send a response to the transaction manager.</param>
		public void SinglePhaseCommit(SinglePhaseEnlistment singlePhaseEnlistment)
		{
			onTxComplete();

			session.Commit(GetLocalOrDistributedTransactionId(transaction));
			singlePhaseEnlistment.Committed();
		}
開發者ID:jtmueller,項目名稱:ravendb,代碼行數:11,代碼來源:PromotableRavenClientEnlistment.cs

示例4:

		void IPromotableSinglePhaseNotification.SinglePhaseCommit( SinglePhaseEnlistment singlePhaseEnlistment ) {
			this.simpleTransaction.Commit();
			singlePhaseEnlistment.Committed();
			DriverTransactionManager.RemoveDriverInTransaction( this.baseTransaction );
			this.connection.driver.CurrentTransaction = null;
			if( this.connection.State == ConnectionState.Closed ) {
				this.connection.CloseFully();
			}
		}
開發者ID:GodLesZ,項目名稱:svn-dump,代碼行數:9,代碼來源:MySqlPromotableTransaction.cs

示例5: SinglePhaseCommit

    public void SinglePhaseCommit(SinglePhaseEnlistment singlePhaseEnlistment)
    {
      simpleTransaction.Commit();
      singlePhaseEnlistment.Committed();
      DriverTransactionManager.RemoveDriverInTransaction(baseTransaction);

      if (connection.State == ConnectionState.Closed)
        connection.CloseFully();
    }
開發者ID:BjkGkh,項目名稱:R106,代碼行數:9,代碼來源:MySqlPromotableTransaction.cs

示例6:

        void IPromotableSinglePhaseNotification.Rollback(SinglePhaseEnlistment singlePhaseEnlistment)
        {
            simpleTransaction.Rollback();
            singlePhaseEnlistment.Aborted();
            DriverTransactionManager.RemoveDriverInTransaction(baseTransaction);

            connection.driver.CurrentTransaction = null;

            if (connection.State == ConnectionState.Closed)
                connection.CloseFully();
        }
開發者ID:tdhieu,項目名稱:openvss,代碼行數:11,代碼來源:MySqlPromotableTransaction.cs

示例7: SinglePhaseCommit

 public void SinglePhaseCommit(SinglePhaseEnlistment singlePhaseEnlistment)
 {
     try
     {
         Neo4jTransaction.DoCommit(_transactionExecutionEnvironment);
         singlePhaseEnlistment.Committed();
     }
     finally
     {
         singlePhaseEnlistment.Aborted();
     }
 }
開發者ID:albumprinter,項目名稱:Neo4jClient,代碼行數:12,代碼來源:Neo4jTransactionResourceManager.cs

示例8: SinglePhaseCommit

 public void SinglePhaseCommit(SinglePhaseEnlistment singlePhaseEnlistment)
 {
     try
     {
         Commit();
         singlePhaseEnlistment.Done();
     }
     catch (Exception)
     {
         //on a callback thread, can't throw
     }
 }
開發者ID:jmptrader,項目名稱:LightningQueues,代碼行數:12,代碼來源:TransactionEnlistment.cs

示例9: SinglePhaseCommit

        public void SinglePhaseCommit(SinglePhaseEnlistment en)
        {
            if (en == null)
                throw new ArgumentNullException("en");

            //
            // Wait until IPendingWork members have completed (WinOE bugs 17580 and 13395)
            try
            {
                handle.WaitOne();
            }
            catch (ObjectDisposedException)
            {
                // If an ObjectDisposedException is thrown because
                // the WaitHandle has already closed, nothing to worry
                // about. Move on.
            }

            lock (syncRoot)
            {
                try
                {
                    this.transaction.Commit();
                    en.Committed();
                }
                catch (Exception e)
                {
                    en.Aborted(e);
                }
                finally
                {
                    if ((null != connection) && (ConnectionState.Closed != connection.State))
                    {
                        connection.Close();
                        connection = null;
                    }
                }
            }
        }
開發者ID:nlh774,項目名稱:DotNetReferenceSource,代碼行數:39,代碼來源:LocalTransaction.cs

示例10: Rollback

    public void Rollback(SinglePhaseEnlistment singlePhaseEnlistment)
    {
      // prevent commands in main thread to run concurrently
      Driver driver = connection.driver;
      lock (driver)
      {
        rollbackThreadId = Thread.CurrentThread.ManagedThreadId;
        while (connection.Reader != null)
        {
          // wait for reader to finish. Maybe we should not wait 
          // forever and cancel it after some time?
          System.Threading.Thread.Sleep(100);
        }
        simpleTransaction.Rollback();
        singlePhaseEnlistment.Aborted();
        DriverTransactionManager.RemoveDriverInTransaction(baseTransaction);

        if (connection.State == ConnectionState.Closed)
          connection.CloseFully();
        rollbackThreadId = 0;
      }
    }
開發者ID:BjkGkh,項目名稱:R106,代碼行數:22,代碼來源:MySqlPromotableTransaction.cs

示例11: Rollback

 public void Rollback(SinglePhaseEnlistment singlePhaseEnlistment) {}
開發者ID:npgsql,項目名稱:npgsql,代碼行數:1,代碼來源:SystemTransactionTests.cs

示例12: SinglePhaseCommit

 public void SinglePhaseCommit(SinglePhaseEnlistment singlePhaseEnlistment) {}
開發者ID:npgsql,項目名稱:npgsql,代碼行數:1,代碼來源:SystemTransactionTests.cs

示例13: SinglePhaseCommit

 public void SinglePhaseCommit(SinglePhaseEnlistment singlePhaseEnlistment)
 {
     _log.Debug("Single Phase Commit");
     if (_npgsqlTx != null)
     {
         _npgsqlTx.Commit();
         _npgsqlTx.Dispose();
         _npgsqlTx = null;
         singlePhaseEnlistment.Committed();
         _connection.PromotableLocalTransactionEnded();
     }
     else if (_callbacks != null)
     {
         if (_rm != null)
         {
             _rm.CommitWork(_callbacks.GetName());
             singlePhaseEnlistment.Committed();
         }
         else
         {
             _callbacks.CommitTransaction();
             singlePhaseEnlistment.Committed();
         }
         _callbacks = null;
     }
     _inTransaction = false;
 }
開發者ID:roji,項目名稱:Npgsql,代碼行數:27,代碼來源:NpgsqlPromotableSinglePhaseNotification.cs

示例14: Rollback

		/// <summary>
		/// Rollbacks the specified single phase enlistment.
		/// </summary>
		/// <param name="singlePhaseEnlistment">The single phase enlistment.</param>
		public void Rollback(SinglePhaseEnlistment singlePhaseEnlistment)
		{
			onTxComplete();
			try
			{
				session.Rollback(PromotableRavenClientEnlistment.GetLocalOrDistributedTransactionId(transaction));

				using (var machineStoreForApplication = IsolatedStorageFile.GetMachineStoreForDomain())
				{
					machineStoreForApplication.DeleteFile(TransactionRecoveryInformationFileName);
				}
			}
			catch (Exception e)
			{
				logger.ErrorException("Could not rollback distributed transaction", e);
				singlePhaseEnlistment.InDoubt(e);
				return;
			}
			singlePhaseEnlistment.Aborted();
		}
開發者ID:remcoros,項目名稱:ravendb,代碼行數:24,代碼來源:RavenClientEnlistment.cs

示例15: Rollback

 public void Rollback(SinglePhaseEnlistment singlePhaseEnlistment)
 {
     singlePhaseEnlistment.Done();
 }
開發者ID:areicher,項目名稱:NServiceBus.RavenDB,代碼行數:4,代碼來源:FakePromotableResourceManager.cs


注:本文中的System.Transactions.SinglePhaseEnlistment類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。