• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Transactions.SinglePhaseEnlistment类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Transactions.SinglePhaseEnlistment的典型用法代码示例。如果您正苦于以下问题:C# SinglePhaseEnlistment类的具体用法?C# SinglePhaseEnlistment怎么用?C# SinglePhaseEnlistment使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SinglePhaseEnlistment类属于System.Transactions命名空间,在下文中一共展示了SinglePhaseEnlistment类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: SinglePhaseCommit

 public void SinglePhaseCommit(SinglePhaseEnlistment singlePhaseEnlistment)
 {
     _callbacks.CommitTransaction();
     singlePhaseEnlistment.Committed();
     _callbacks.Dispose();
 }
开发者ID:ArsenShnurkov,项目名称:npgsql,代码行数:6,代码来源:NpgsqlResourceManager.cs


示例17: Rollback

		/// <summary>
		/// Notifies an enlisted object that the transaction is being rolled back.
		/// </summary>
		/// <param name="singlePhaseEnlistment">A <see cref="T:System.Transactions.SinglePhaseEnlistment"/> object used to send a response to the transaction manager.</param>
		public void Rollback(SinglePhaseEnlistment singlePhaseEnlistment)
		{
			onTxComplete(); 
			session.Rollback(GetLocalOrDistributedTransactionId(transaction));
			singlePhaseEnlistment.Aborted();
		}
开发者ID:jtmueller,项目名称:ravendb,代码行数:10,代码来源:PromotableRavenClientEnlistment.cs


示例18: Dispose

 ///<summary>
 /// Attempt to rollback the internal transaction.
 ///</summary>
 void IPromotableSinglePhaseNotification.Rollback(SinglePhaseEnlistment singlePhaseEnlistment)
 {
     try
     {
         // attempt to rollback the transaction
         this.dbTransaction.Rollback();
         singlePhaseEnlistment.Done();
     }
     finally
     {
         // clean-up our resources
         Dispose();
     }
 }
开发者ID:JuRogn,项目名称:OA,代码行数:17,代码来源:AdoWorkBatchService.cs


示例19: 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(transaction.LocalIdentifier);

				DeleteFile();
			}
			catch (Exception e)
			{
				logger.ErrorException("Could not rollback distributed transaction", e);
				singlePhaseEnlistment.InDoubt(e);
				return;
			}
			singlePhaseEnlistment.Aborted();
			ctx.Dispose();
		}
开发者ID:925coder,项目名称:ravendb,代码行数:22,代码来源:RavenClientEnlistment.cs


示例20: catch

 ///<summary>
 /// Attempt to commit the internal transaction.
 ///</summary>
 void IPromotableSinglePhaseNotification.SinglePhaseCommit(SinglePhaseEnlistment singlePhaseEnlistment)
 {
     try
     {
         // attempt to commit the enlistment
         this.dbTransaction.Commit();
         singlePhaseEnlistment.Committed();
     }
     catch (Exception e)
     {
         // something went wrong, make sure the transaction aborts
         singlePhaseEnlistment.Aborted(e);
         throw;
     }
     finally
     {
         // clean-up our resources
         Dispose();
     }
 }
开发者ID:JuRogn,项目名称:OA,代码行数:23,代码来源:AdoWorkBatchService.cs



注:本文中的System.Transactions.SinglePhaseEnlistment类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Transactions.Transaction类代码示例发布时间:2022-05-26
下一篇:
C# Transactions.PreparingEnlistment类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap