TransactionFlowAttribute 클래스

정의

서비스 작업이 클라이언트로부터 들어오는 트랜잭션을 허용하는지 여부를 지정합니다.

public ref class TransactionFlowAttribute sealed : Attribute, System::ServiceModel::Description::IOperationBehavior
[System.AttributeUsage(System.AttributeTargets.Method)]
public sealed class TransactionFlowAttribute : Attribute, System.ServiceModel.Description.IOperationBehavior
[<System.AttributeUsage(System.AttributeTargets.Method)>]
type TransactionFlowAttribute = class
    inherit Attribute
    interface IOperationBehavior
Public NotInheritable Class TransactionFlowAttribute
Inherits Attribute
Implements IOperationBehavior
상속
TransactionFlowAttribute
특성
구현

예제

다음 코드 예제에서는 작업 수준에서 이 열거형을 TransactionFlowOption 클래스와 함께 사용하는 방법을 보여 줍니다.

using System;  
using System.ServiceModel;  
using System.Transactions;  

namespace Microsoft.WCF.Documentation  
{  
  [ServiceContract(  
    Namespace="http://microsoft.wcf.documentation",   
    SessionMode=SessionMode.Required  
  )]  
  public interface IBehaviorService  
  {  
    [OperationContract]  
    [TransactionFlow(TransactionFlowOption.Mandatory)]  
    string TxWork(string message);  
  }  

  // Note: To use the TransactionIsolationLevel property, you   
  // must add a reference to the System.Transactions.dll assembly.  
  /* The following service implementation:  
   *   -- Processes messages on one thread at a time  
   *   -- Creates one service object per session  
   *   -- Releases the service object when the transaction commits  
   */  
  [ServiceBehavior(  
    ConcurrencyMode=ConcurrencyMode.Single,  
    InstanceContextMode=InstanceContextMode.PerSession,  
    ReleaseServiceInstanceOnTransactionComplete=true  
  )]  
  public class BehaviorService : IBehaviorService, IDisposable  
  {  
    Guid myID;  

    public BehaviorService()  
    {  
      myID = Guid.NewGuid();  
      Console.WriteLine(  
        "Object "  
        + myID.ToString()  
        + " created.");  
    }  

    /*  
    / * The following operation-level behaviors are specified:  
    / * Always executes under a transaction scope.  
    / * The transaction scope is completed when the operation  
    / * terminates without an unhandled exception.  
    /*  
    [OperationBehavior(  
      TransactionAutoComplete = true,  
      TransactionScopeRequired = true  
    )]  
    public string TxWork(string message)  
    {  
      // Do some transactable work.  
      Console.WriteLine("TxWork called with: " + message);  
      // Display transaction information.  

      TransactionInformation info = Transaction.Current.TransactionInformation;  
      Console.WriteLine("The distributed tx ID: {0}.", info.DistributedIdentifier);  
      Console.WriteLine("The tx status: {0}.", info.Status);  
      return String.Format("Hello. This was object {0}.",myID.ToString()) ;  
    }  

    public void Dispose()  
    {  
      Console.WriteLine(  
        "Service "  
        + myID.ToString()  
        + " is being recycled."  
      );  
    }  
  }  
}  

설명

TransactionFlowAttribute는 특정 트랜잭션 흐름 정책을 서비스 작업과 연결하기 위해 선언적으로 사용되는 특성입니다. 이 특성의 TransactionFlowOption 속성은 각 작업이 클라이언트로부터 들어오는 트랜잭션을 허용하는지 또는 해당 작업을 위해 클라이언트가 항상 트랜잭션을 이동해야 하는지 지정합니다. TransactionFlowAttribute는 트랜잭션 흐름 정책을 특정 작업과 프로그래밍 방식으로 연결하기 위한 작업 동작으로 사용될 수도 있습니다. 이 경우에 추가할 해야는 Behaviors 작업의 설명에는 컬렉션입니다.

참고

OperationContract를 사용하는 각 메서드의 TransactionFlowAttribute는 정규화된 Action 문자열을 제공해야 합니다. "*" 값은 지원되지 않습니다.

생성자

TransactionFlowAttribute(TransactionFlowOption)

TransactionFlowAttribute 클래스의 새 인스턴스를 초기화합니다.

속성

Transactions

들어오는 트랜잭션이 지원되는지 여부를 나타내는 값을 가져옵니다.

TypeId

파생 클래스에서 구현된 경우 이 Attribute에 대한 고유 식별자를 가져옵니다.

(다음에서 상속됨 Attribute)

메서드

Equals(Object)

이 인스턴스가 지정된 개체와 같은지를 나타내는 값을 반환합니다.

(다음에서 상속됨 Attribute)
GetHashCode()

이 인스턴스의 해시 코드를 반환합니다.

(다음에서 상속됨 Attribute)
GetType()

현재 인스턴스의 Type을 가져옵니다.

(다음에서 상속됨 Object)
IsDefaultAttribute()

파생 클래스에서 재정의된 경우 이 인스턴스 값이 파생 클래스에 대한 기본값인지 여부를 표시합니다.

(다음에서 상속됨 Attribute)
Match(Object)

파생 클래스에서 재정의된 경우 이 인스턴스가 지정된 개체와 같은지 여부를 나타내는 값을 반환합니다.

(다음에서 상속됨 Attribute)
MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)

명시적 인터페이스 구현

_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

이름 집합을 해당하는 디스패치 식별자 집합에 매핑합니다.

(다음에서 상속됨 Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

인터페이스의 형식 정보를 가져오는 데 사용할 수 있는 개체의 형식 정보를 검색합니다.

(다음에서 상속됨 Attribute)
_Attribute.GetTypeInfoCount(UInt32)

개체에서 제공하는 형식 정보 인터페이스의 수를 검색합니다(0 또는 1).

(다음에서 상속됨 Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

개체에서 노출하는 메서드와 속성에 대한 액세스를 제공합니다.

(다음에서 상속됨 Attribute)
IOperationBehavior.AddBindingParameters(OperationDescription, BindingParameterCollection)

이 작업의 동작을 지원하기 위해 추가 매개 변수(설정)를 바인딩 컨텍스트에 추가합니다. 이 메서드는 상속될 수 없습니다.

IOperationBehavior.ApplyClientBehavior(OperationDescription, ClientOperation)

특성 기능을 특성이 표시하는 메서드의 ProxyOperation 개체에 연결합니다. 이 메서드는 상속될 수 없습니다.

IOperationBehavior.ApplyDispatchBehavior(OperationDescription, DispatchOperation)

특성 기능을 특성이 표시하는 메서드의 DispatchOperation 개체에 연결합니다. 이 메서드는 상속될 수 없습니다.

IOperationBehavior.Validate(OperationDescription)

해당 작업이 이 동작을 지원할 수 있는지 확인합니다. 이 메서드는 상속될 수 없습니다.

적용 대상

추가 정보