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


C# InternalTransaction.ThrowIfPromoterTypeIsNotMSDTC方法代码示例

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


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

示例1: GetObjectData

        internal override void GetObjectData(InternalTransaction tx, SerializationInfo serializationInfo, StreamingContext context)
        {
            Debug.Assert(tx.PromotedTransaction != null, "Promoted state not valid for transaction.");

            // This is not allowed if the transaction's PromoterType is not MSDTC.
            tx.ThrowIfPromoterTypeIsNotMSDTC();

            // Simply get call get object data for the promoted transaction.
            ISerializable serializableTx = tx.PromotedTransaction as ISerializable;
            if (serializableTx == null)
            {
                // The LTM can only support this if the Distributed TM Supports it.
                throw new NotSupportedException();
            }

            // Before forwarding this call to the promoted tx make sure to change
            // the full type info so that only if the promoted tx does not set this
            // then it should be set correctly.
            serializationInfo.FullTypeName = tx.PromotedTransaction.GetType().FullName;

            // Now forward the call.
            serializableTx.GetObjectData(serializationInfo, context);
        }
开发者ID:hughbe,项目名称:corefx,代码行数:23,代码来源:TransactionState.cs

示例2: EnlistDurable

        internal override Enlistment EnlistDurable(
            InternalTransaction tx,
            Guid resourceManagerIdentifier,
            ISinglePhaseNotification enlistmentNotification,
            EnlistmentOptions enlistmentOptions,
            Transaction atomicTransaction
            )
        {
            Debug.Assert(tx.PromotedTransaction != null, "Promoted state not valid for transaction.");

            tx.ThrowIfPromoterTypeIsNotMSDTC();

            // Don't hold locks while calling into the promoted tx
            Monitor.Exit(tx);
            try
            {
                Enlistment en = new Enlistment(
                    resourceManagerIdentifier,
                    tx,
                    enlistmentNotification,
                    enlistmentNotification,
                    atomicTransaction
                    );
                EnlistmentState.EnlistmentStatePromoted.EnterState(en.InternalEnlistment);

                en.InternalEnlistment.PromotedEnlistment =
                    tx.PromotedTransaction.EnlistDurable(
                        resourceManagerIdentifier,
                        (DurableInternalEnlistment)en.InternalEnlistment,
                        true,
                        enlistmentOptions
                        );
                return en;
            }
            finally
            {
                Monitor.Enter(tx);
            }
        }
开发者ID:hughbe,项目名称:corefx,代码行数:39,代码来源:TransactionState.cs


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