TransactionScope 构造函数

定义

初始化 TransactionScope 类的新实例。

public:
 TransactionScope();
public TransactionScope ();
Public Sub New ()

示例

下面的代码示例演示如何创建 TransactionScope 活动。

new TransactionScope
{
    Body = new Sequence
    {
        Activities =
        {
            new WriteLine { Text = "    Begin TransactionScope" },

            new PrintTransactionId(),

            new TransactionScopeTest(),

            new WriteLine { Text = "    End TransactionScope" },
        },
    },
},

适用于