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


C# EnlistmentOptions类代码示例

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


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

示例1: TestInitialize

        public void TestInitialize()
        {
            target = new TransactionEnlistmentHelper();

            ensureTransaction = true;
            options = EnlistmentOptions.None;

            enlistmentNotification = MockRepository.GenerateMock<IEnlistmentNotification>();
            enlistmentNotification.Expect( en => en.Prepare( null ) )
                .IgnoreArguments()
                .WhenCalled( a =>
                {
                    PreparingEnlistment e = a.Arguments.GetValue( 0 ) as PreparingEnlistment;
                    e.Prepared();
                } )
                .Repeat.Once();

            enlistmentNotification.Expect( en => en.Commit( null ) )
                .IgnoreArguments()
                .WhenCalled( a =>
                {
                    Enlistment e = a.Arguments.GetValue( 0 ) as Enlistment;
                    e.Done();
                } )
                .Repeat.Once();
        }
开发者ID:RadicalFx,项目名称:Radical,代码行数:26,代码来源:TransactionEnlistmentHelperEventsTest.cs

示例2: EnlistVolatile

		/// <summary>
		/// Enlists a resource manager in this transaction.
		/// </summary>
		/// <param name="p_entNotification">The resource manager to enlist.</param>
		/// <param name="p_eopOptions">The enlistment options. This value must be <see cref="EnlistmentOptions.None"/>.</param>
		/// <exception cref="ArgumentException">Thrown if <paramref name="p_eopOptions"/> is not
		/// <see cref="EnlistmentOptions.None"/>.</exception>
		public void EnlistVolatile(IEnlistmentNotification p_entResourceManager, EnlistmentOptions p_eopOptions)
		{
			if (p_eopOptions != EnlistmentOptions.None)
				throw new ArgumentException("EnlistmentOptions must be None.", "p_eopOptions");

			m_lstNotifications.Add(p_entResourceManager);
		}
开发者ID:NexusMods,项目名称:NexusModManager-4.5,代码行数:14,代码来源:Transaction.cs

示例3: TestCleanup

        public void TestCleanup()
        {
            target = null;
            ensureTransaction = true;
            options = EnlistmentOptions.None;

            enlistmentNotification = null;
        }
开发者ID:RadicalFx,项目名称:Radical,代码行数:8,代码来源:TransactionEnlistmentHelperEventsTest.cs

示例4: OletxVolatileEnlistment

 internal OletxVolatileEnlistment(IEnlistmentNotificationInternal enlistmentNotification, EnlistmentOptions enlistmentOptions, OletxTransaction oletxTransaction) : base(null, oletxTransaction)
 {
     this.iEnlistmentNotification = enlistmentNotification;
     this.enlistDuringPrepareRequired = (enlistmentOptions & EnlistmentOptions.EnlistDuringPrepareRequired) != EnlistmentOptions.None;
     this.container = null;
     this.pendingOutcome = TransactionStatus.Active;
     if (DiagnosticTrace.Information)
     {
         EnlistmentTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceOletx"), base.InternalTraceIdentifier, EnlistmentType.Volatile, enlistmentOptions);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:11,代码来源:OletxVolatileEnlistment.cs

示例5: Enlistment

 internal Enlistment(InternalTransaction transaction, IEnlistmentNotification twoPhaseNotifications, ISinglePhaseNotification singlePhaseNotifications, Transaction atomicTransaction, EnlistmentOptions enlistmentOptions)
 {
     if ((enlistmentOptions & EnlistmentOptions.EnlistDuringPrepareRequired) != EnlistmentOptions.None)
     {
         this.internalEnlistment = new System.Transactions.InternalEnlistment(this, transaction, twoPhaseNotifications, singlePhaseNotifications, atomicTransaction);
     }
     else
     {
         this.internalEnlistment = new Phase1VolatileEnlistment(this, transaction, twoPhaseNotifications, singlePhaseNotifications, atomicTransaction);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:11,代码来源:Enlistment.cs

示例6: Trace

 internal static void Trace(string traceSource, EnlistmentTraceIdentifier enTraceId, EnlistmentType enType, EnlistmentOptions enOptions)
 {
     lock (record)
     {
         record.traceSource = traceSource;
         record.enTraceId = enTraceId;
         record.enType = enType;
         record.enOptions = enOptions;
         DiagnosticTrace.TraceEvent(TraceEventType.Information, "http://msdn.microsoft.com/2004/06/System/Transactions/Enlistment", System.Transactions.SR.GetString("TraceEnlistment"), record);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:11,代码来源:EnlistmentTraceRecord.cs

示例7: DurableEnlistmentNotification

        protected DurableEnlistmentNotification(Guid resourceManager,
                                                EnlistmentOptions enlistmentOptions)
        {
            Trace.WriteIf(Tracing.Is.TraceVerbose, "resourceManager={0} enlistmentOptions={1}".FormatWith(resourceManager, enlistmentOptions.ToString("G")));
            Operation = new Operation(resourceManager);
            if (null == Transaction.Current)
            {
                throw new InvalidOperationException("There is no transaction scope to enlist with.");
            }

            Transaction.Current.EnlistDurable(resourceManager, this, enlistmentOptions);
            Transaction.Current.TransactionCompleted += OnTransactionCompleted;
        }
开发者ID:KarlDirck,项目名称:cavity,代码行数:13,代码来源:DurableEnlistmentNotification.cs

示例8: EnlistDurable

 internal override Enlistment EnlistDurable(InternalTransaction tx, Guid resourceManagerIdentifier, ISinglePhaseNotification enlistmentNotification, EnlistmentOptions enlistmentOptions, Transaction atomicTransaction)
 {
     if ((tx.durableEnlistment != null) || ((enlistmentOptions & EnlistmentOptions.EnlistDuringPrepareRequired) != EnlistmentOptions.None))
     {
         tx.promoteState.EnterState(tx);
         return tx.State.EnlistDurable(tx, resourceManagerIdentifier, enlistmentNotification, enlistmentOptions, atomicTransaction);
     }
     Enlistment enlistment = new Enlistment(resourceManagerIdentifier, tx, enlistmentNotification, enlistmentNotification, atomicTransaction);
     tx.durableEnlistment = enlistment.InternalEnlistment;
     DurableEnlistmentState._DurableEnlistmentActive.EnterState(tx.durableEnlistment);
     if (DiagnosticTrace.Information)
     {
         EnlistmentTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceLtm"), tx.durableEnlistment.EnlistmentTraceId, EnlistmentType.Durable, EnlistmentOptions.None);
     }
     return enlistment;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:16,代码来源:EnlistableStates.cs

示例9: EnlistVolatile

 internal override Enlistment EnlistVolatile(InternalTransaction tx, ISinglePhaseNotification enlistmentNotification, EnlistmentOptions enlistmentOptions, Transaction atomicTransaction)
 {
     Enlistment enlistment = new Enlistment(tx, enlistmentNotification, enlistmentNotification, atomicTransaction, enlistmentOptions);
     if ((enlistmentOptions & EnlistmentOptions.EnlistDuringPrepareRequired) != EnlistmentOptions.None)
     {
         base.AddVolatileEnlistment(ref tx.phase0Volatiles, enlistment);
     }
     else
     {
         base.AddVolatileEnlistment(ref tx.phase1Volatiles, enlistment);
     }
     if (DiagnosticTrace.Information)
     {
         EnlistmentTraceRecord.Trace(System.Transactions.SR.GetString("TraceSourceLtm"), enlistment.InternalEnlistment.EnlistmentTraceId, EnlistmentType.Volatile, enlistmentOptions);
     }
     return enlistment;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:17,代码来源:TransactionStatePhase0.cs

示例10: TwoPhaseDurable

        public void TwoPhaseDurable(int volatileCount, EnlistmentOptions volatileEnlistmentOption, EnlistmentOptions durableEnlistmentOption, Phase1Vote volatilePhase1Vote, Phase1Vote durablePhase1Vote, bool commit, EnlistmentOutcome expectedVolatileOutcome, EnlistmentOutcome expectedDurableOutcome, TransactionStatus expectedTxStatus)
        {
            Transaction tx = null;
            try
            {
                using (TransactionScope ts = new TransactionScope())
                {
                    tx = Transaction.Current.Clone();

                    if (volatileCount > 0)
                    {
                        TestEnlistment[] volatiles = new TestEnlistment[volatileCount];
                        for (int i = 0; i < volatileCount; i++)
                        {
                            // It doesn't matter what we specify for SinglePhaseVote.
                            volatiles[i] = new TestEnlistment(volatilePhase1Vote, expectedVolatileOutcome);
                            tx.EnlistVolatile(volatiles[i], volatileEnlistmentOption);
                        }
                    }

                    TestEnlistment durable = new TestEnlistment(Phase1Vote.Prepared, expectedDurableOutcome);
                    // TODO: Issue #10353 - This needs to change once we have promotion support.
                    Assert.Throws<PlatformNotSupportedException>(() => // Creation of two phase durable enlistment attempts to promote to MSDTC
                    {
                        tx.EnlistDurable(Guid.NewGuid(), durable, durableEnlistmentOption);
                    });

                    if (commit)
                    {
                        ts.Complete();
                    }
                }
            }
            catch (TransactionInDoubtException)
            {
                Assert.Equal(expectedTxStatus, TransactionStatus.InDoubt);
            }
            catch (TransactionAbortedException)
            {
                Assert.Equal(expectedTxStatus, TransactionStatus.Aborted);
            }

            Assert.NotNull(tx);
            Assert.Equal(expectedTxStatus, tx.TransactionInformation.Status);
        }
开发者ID:geoffkizer,项目名称:corefx,代码行数:45,代码来源:LTMEnlistmentTests.cs

示例11: SinglePhaseDurable

        public void SinglePhaseDurable(int volatileCount, EnlistmentOptions volatileEnlistmentOption, Phase1Vote volatilePhase1Vote, SinglePhaseVote singlePhaseVote, bool commit, EnlistmentOutcome expectedVolatileOutcome, TransactionStatus expectedTxStatus)
        {
            Transaction tx = null;
            try
            {
                using (TransactionScope ts = new TransactionScope())
                {
                    tx = Transaction.Current.Clone();

                    if (volatileCount > 0)
                    {
                        TestSinglePhaseEnlistment[] volatiles = new TestSinglePhaseEnlistment[volatileCount];
                        for (int i = 0; i < volatileCount; i++)
                        {
                            // It doesn't matter what we specify for SinglePhaseVote.
                            volatiles[i] = new TestSinglePhaseEnlistment(volatilePhase1Vote, SinglePhaseVote.InDoubt, expectedVolatileOutcome);
                            tx.EnlistVolatile(volatiles[i], volatileEnlistmentOption);
                        }
                    }

                    // Doesn't really matter what we specify for EnlistmentOutcome here. This is an SPC, so Phase2 won't happen for this enlistment.
                    TestSinglePhaseEnlistment durable = new TestSinglePhaseEnlistment(Phase1Vote.Prepared, singlePhaseVote, EnlistmentOutcome.Committed);
                    tx.EnlistDurable(Guid.NewGuid(), durable, EnlistmentOptions.None);

                    if (commit)
                    {
                        ts.Complete();
                    }
                }
            }
            catch (TransactionInDoubtException)
            {
                Assert.Equal(expectedTxStatus, TransactionStatus.InDoubt);
            }
            catch (TransactionAbortedException)
            {
                Assert.Equal(expectedTxStatus, TransactionStatus.Aborted);
            }


            Assert.NotNull(tx);
            Assert.Equal(expectedTxStatus, tx.TransactionInformation.Status);
        }
开发者ID:geoffkizer,项目名称:corefx,代码行数:43,代码来源:LTMEnlistmentTests.cs

示例12: TransactionstateEnlist

 internal void TransactionstateEnlist(EnlistmentTraceIdentifier enlistmentID, EnlistmentType enlistmentType, EnlistmentOptions enlistmentOption)
 {
     if (IsEnabled(EventLevel.Informational, ALL_KEYWORDS))
     {
         TransactionstateEnlist(enlistmentID.EnlistmentIdentifier.ToString(), enlistmentType.ToString(), enlistmentOption.ToString());
     }
 }
开发者ID:chcosta,项目名称:corefx,代码行数:7,代码来源:TransactionsEtwProvider.cs

示例13: EnlistDurable

		public Enlistment EnlistDurable (Guid manager,
			IEnlistmentNotification notification,
			EnlistmentOptions options)
		{
			throw new NotImplementedException ("DTC unsupported, only SinglePhase commit supported for durable resource managers.");
		}
开发者ID:Profit0004,项目名称:mono,代码行数:6,代码来源:Transaction.cs

示例14: EnlistVolatile

 public Enlistment EnlistVolatile(IEnlistmentNotification enlistmentNotification, EnlistmentOptions enlistmentOptions)
 {
 }
开发者ID:Pengfei-Gao,项目名称:source-Insight-3-for-centos7,代码行数:3,代码来源:SubordinateTransaction.cs

示例15: EnlistDurable

 public Enlistment EnlistDurable(System.Guid resourceManagerIdentifier, ISinglePhaseNotification singlePhaseNotification, EnlistmentOptions enlistmentOptions)
 {
 }
开发者ID:Pengfei-Gao,项目名称:source-Insight-3-for-centos7,代码行数:3,代码来源:SubordinateTransaction.cs


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