ContextUtil.TransactionId 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取当前 COM+ DTC 事务的 GUID。
public:
static property Guid TransactionId { Guid get(); };
public static Guid TransactionId { get; }
static member TransactionId : Guid
Public Shared ReadOnly Property TransactionId As Guid
属性值
一个 GUID,表示当前 COM+ DTC 事务(如果存在该事务)。
例外
没有可用的 COM+ 上下文。
示例
下面的代码示例获取 属性的值 TransactionId 。
[Transaction(TransactionOption::Required)]
public ref class ContextUtil_TransactionId: public ServicedComponent
{
public:
void Example()
{
// Display the ID of the transaction in which the current COM+ context
// is enlisted.
Console::WriteLine( "Transaction ID: {0}", ContextUtil::TransactionId );
}
};
[Transaction(TransactionOption.Required)]
public class ContextUtil_TransactionId : ServicedComponent
{
public void Example()
{
// Display the ID of the transaction in which the current COM+ context
// is enlisted.
Console.WriteLine("Transaction ID: {0}", ContextUtil.TransactionId);
}
}
<Transaction(TransactionOption.Required)> _
Public Class ContextUtil_TransactionId
Inherits ServicedComponent
Public Sub Example()
' Display the ID of the transaction in which the current COM+ context
' is enlisted.
MsgBox("Transaction ID: " & ContextUtil.TransactionId.ToString())
End Sub
End Class