編輯

共用方式為


TransactionMessageProperty.Set(Transaction, Message) Method

Definition

Sets the transaction that will be used when executing the service method.

public:
 static void Set(System::Transactions::Transaction ^ transaction, System::ServiceModel::Channels::Message ^ message);
public static void Set (System.Transactions.Transaction transaction, System.ServiceModel.Channels.Message message);
static member Set : System.Transactions.Transaction * System.ServiceModel.Channels.Message -> unit
Public Shared Sub Set (transaction As Transaction, message As Message)

Parameters

transaction
Transaction

The transaction that will be used when executing the service method.

message
Message

The incoming message that results in calling the service method.

Exceptions

The property has already been set on message.

transaction needs to be unmarshaled, and that operation fails.

Remarks

A custom incoming channel (which is part of a service's channel stack) can call this method to add a TransactionMessageProperty, containing the transaction parameter, to the Properties collection of the message parameter. This prompts the infrastructure to create a TransactionScope instance using the transaction passed in, before calling the service method requested in the incoming message. The service method must have the TransactionScopeRequired property set to true.

Applies to