다음을 통해 공유


ContextUtil.IsInTransaction 속성

정의

현재 컨텍스트가 트랜잭션인지 여부를 나타내는 값을 가져옵니다.

public:
 static property bool IsInTransaction { bool get(); };
public static bool IsInTransaction { get; }
static member IsInTransaction : bool
Public Shared ReadOnly Property IsInTransaction As Boolean

속성 값

현재 컨텍스트가 트랜잭션이면 true이고, 그렇지 않으면 false입니다.

예외

사용 가능한 COM+ 컨텍스트가 없는 경우

예제

다음 코드 예제는 속성의 IsInTransaction 값을 가져옵니다.

[Transaction(TransactionOption::Required)]
public ref class ContextUtil_IsInTransaction: public ServicedComponent
{
public:
   void Example()
   {
      // Display whether the current COM+ context is enlisted in a
      // transaction.
      Console::WriteLine( "Current context enlisted in transaction: {0}", 
         ContextUtil::IsInTransaction );
   }
};
[Transaction(TransactionOption.Required)]
public class ContextUtil_IsInTransaction : ServicedComponent
{
    public void Example()
    {
        // Display whether the current COM+ context is enlisted in a
        // transaction.
        Console.WriteLine("Current context enlisted in transaction: {0}",
            ContextUtil.IsInTransaction);
    }
}
<Transaction(TransactionOption.Required)>  _
Public Class ContextUtil_IsInTransaction
    Inherits ServicedComponent
    
    Public Sub Example() 
        ' Display whether the current COM+ context is enlisted in a
        ' transaction.
        MsgBox("Current context enlisted in transaction: " & ContextUtil.IsInTransaction)

    End Sub
End Class

적용 대상