当前位置: 首页>>代码示例>>C#>>正文


C# CommittableTransaction.EndCommit方法代码示例

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


在下文中一共展示了CommittableTransaction.EndCommit方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AsyncFail2

		public void AsyncFail2 ()
		{
			IntResourceManager irm = new IntResourceManager ( 1 );

			CommittableTransaction ct = new CommittableTransaction ();
			/* Set ambient Tx */
			Transaction.Current = ct;

			/* Enlist */
			irm.Value = 2;
			irm.FailPrepare = true;

			IAsyncResult ar = ct.BeginCommit ( null, null );

			ct.EndCommit ( ar );
		}
开发者ID:nlhepler,项目名称:mono,代码行数:16,代码来源:AsyncTest.cs

示例2: Async3

		public void Async3 ()
		{
			IntResourceManager irm = new IntResourceManager ( 1 );

			CommittableTransaction ct = new CommittableTransaction ();
			/* Set ambient Tx */
			Transaction.Current = ct;

			/* Enlist */
			irm.Value = 2;

			IAsyncResult ar = ct.BeginCommit ( null, null );
			ct.EndCommit ( ar );

			irm.Check ( 1, 1, 0, 0, "irm" );
		}
开发者ID:nlhepler,项目名称:mono,代码行数:16,代码来源:AsyncTest.cs

示例3: Async2

		public void Async2 ()
		{
			IntResourceManager irm = new IntResourceManager ( 1 );

			CommittableTransaction ct = new CommittableTransaction ();

			using ( TransactionScope scope = new TransactionScope (ct) ) {
				irm.Value = 2;

				//scope.Complete ();

				IAsyncResult ar = ct.BeginCommit ( null, null);
				try {
					ct.EndCommit ( ar );
				}
				catch ( TransactionAbortedException) {
					irm.Check ( 0, 0, 1, 0, "irm" );
					return;
				}
			}
			Assert.Fail ( "EndCommit should've thrown an exception" );
		}
开发者ID:nlhepler,项目名称:mono,代码行数:22,代码来源:AsyncTest.cs

示例4: ExplicitTransaction12

		public void ExplicitTransaction12 ()
		{
			CommittableTransaction ct = new CommittableTransaction ();

			IntResourceManager irm = new IntResourceManager ( 1 );
			irm.FailPrepare = true;
			ct.BeginCommit ( null, null );
			ct.EndCommit ( null );
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:9,代码来源:TransactionScopeTest.cs

示例5: ExplicitTransaction10b

		public void ExplicitTransaction10b ()
		{
			CommittableTransaction ct = new CommittableTransaction ();

			IntResourceManager irm = new IntResourceManager ( 1 );
			Transaction.Current = ct;
			irm.Value = 2;
			Transaction.Current = null;

			TransactionScope scope = new TransactionScope ( ct );
			Assert.AreEqual ( ct, Transaction.Current, "ambient transaction" );
			//scope2.Complete ();
			//scope2.Dispose ();
			IAsyncResult ar = ct.BeginCommit ( null, null );
			try {
				ct.EndCommit (ar);
			}
			catch ( TransactionAbortedException) {
				irm.Check ( 0, 0, 1, 0, "irm" );
				Transaction.Current = null;
				return;
			}

			Transaction.Current = null;
			Assert.Fail ();
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:26,代码来源:TransactionScopeTest.cs

示例6: ExplicitTransaction12

		public void ExplicitTransaction12 ()
		{
		    ExceptionAssert.Throws<ArgumentException>(
		        delegate
		            {
		                CommittableTransaction ct = new CommittableTransaction();

		                IntResourceManager irm = new IntResourceManager(1);
		                irm.FailPrepare = true;
		                ct.BeginCommit(null, null);
		                ct.EndCommit(null);
		            });
		}
开发者ID:tohosnet,项目名称:Mono.Data.Sqlite,代码行数:13,代码来源:TransactionScopeTest.cs


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