TransactedReceiveScope Classe

Definição

Uma atividade que tem como escopo o tempo de vida de uma transação que é iniciado por uma mensagem recebida.An activity which scopes the lifetime of a transaction which is initiated by a received message. A transação pode ser colocada no fluxo de trabalho na mensagem de inicialização ou ser criada pelo dispatcher quando a mensagem é recebida.The transaction may be flowed into the workflow on the initiating message, or be created by the dispatcher when the message is received.

public ref class TransactedReceiveScope sealed : System::Activities::NativeActivity
[System.Windows.Markup.ContentProperty("Body")]
public sealed class TransactedReceiveScope : System.Activities.NativeActivity
[<System.Windows.Markup.ContentProperty("Body")>]
type TransactedReceiveScope = class
    inherit NativeActivity
Public NotInheritable Class TransactedReceiveScope
Inherits NativeActivity
Herança
TransactedReceiveScope
Atributos

Exemplos

O exemplo a seguir mostra como usar a TransactedReceiveScope classe em uma Sequence atividade.The following example shows how to use the TransactedReceiveScope class in a Sequence activity.

return new Sequence
{
    Activities = 
    {
        new WriteLine { Text = "Service workflow begins." },

        new System.ServiceModel.Activities.TransactedReceiveScope
        {
            Variables = { requestMessage, replyMessage },
            Request = receive,
            Body = new Sequence
            {
                Activities =
                {
                    new WriteLine { Text = new InArgument<string>("Server side: Receive complete.") },
                    
                    new WriteLine { Text = new InArgument<string>(new VisualBasicValue<string>() { ExpressionText = "\"Server side: Received = '\" + requestString.toString() + \"'\"" }) },

                    new PrintTransactionInfo(),

                    new Assign<string>
                    {
                        Value = new InArgument<string>("Server side: Sending reply."),
                        To = new OutArgument<string>(replyMessage)
                    },

                    new WriteLine { Text = new InArgument<string>("Server side: Begin reply.") },

                    new SendReply
                    {
                        Request = receive,
                        Content = SendContent.Create(new InArgument<string>(replyMessage)),                                    
                    },

                    new WriteLine { Text = new InArgument<string>("Server side: Reply sent.") },
                },
            },
        },

        new WriteLine { Text = "Server workflow ends." },
    },
};

Comentários

A TransactedReceiveScope atividade permite controlar o tempo de vida da transação fluida.The TransactedReceiveScope activity enables you to control the lifetime of the flowed transaction.

Aviso

Para uma atividade de inicialização TransactedReceiveScope (um TransactedReceiveScope que contém uma Receive atividade com CanCreateInstance definido como true ), a transação é criada antes de o tempo de execução começar a executar a TransactedReceiveScope atividade.For an initiating TransactedReceiveScope activity (a TransactedReceiveScope that contains a Receive activity with CanCreateInstance set to true), the transaction is created before the runtime starts to execute the TransactedReceiveScope activity. Essa transação não é ambiente na camada de atividade do fluxo de trabalho, mas é ambiente nas camadas de persistência subjacentes.This transaction is not ambient at the workflow activity layer, but it is ambient in the underlying persistence layers. Se a execução do fluxo de trabalho encontrar uma Persist atividade antes da TransactedReceiveScope atividade, o tempo de execução tentará persistir na transação de ambiente.If execution of the workflow encounters a Persist activity before the TransactedReceiveScope activity, the runtime tries to persist under the ambient transaction. Esse comportamento causa um bloqueio até que a transação seja concluída.This behavior causes a block until the transaction is completed. Como a execução do fluxo de trabalho não chegou à Body seção, a transação não pode ser concluída.Because the workflow execution has not reached the Body section, the transaction cannot finish. Esse deadlock faz com que o fluxo de trabalho pare de responder até que a transação expire. Quando a transação atinge o tempo limite, a instância recém-criada é anulada.This deadlock causes the workflow to stop responding until the transaction times out. When the transaction times out, the newly created instance is aborted.

Importante

Sempre que você usar um TransactedReceiveScope , é recomendável fazer todos os recebimentos no fluxo de trabalho dentro das TransactedReceiveScope atividades.Whenever you use a TransactedReceiveScope it is recommended to place all Receives in the workflow within TransactedReceiveScope activities.

Importante

Ao usar o TransactedReceiveScope e as mensagens chegarem na ordem incorreta, o fluxo de trabalho será anulado ao tentar entregar a primeira mensagem fora de ordem.When using TransactedReceiveScope and messages arrive in the incorrect order, the workflow will be aborted when trying to deliver the first out of order message. Você deve verificar se o fluxo de trabalho está sempre em um ponto de interrupção consistente quando o fluxo de trabalho está ocioso.You must make sure your workflow is always at a consistent stopping point when the workflow idles. Isso permitirá que você reinicie o fluxo de trabalho de um ponto de persistência anterior caso o fluxo de trabalho seja anulado.This will allow you to restart the workflow from a previous persistence point should the workflow be aborted.

Construtores

TransactedReceiveScope()

Inicializa uma nova instância da classe TransactedReceiveScope.Initializes a new instance of the TransactedReceiveScope class.

Propriedades

Body

Obtém ou define o Activity que compõe o corpo do TransactedReceiveScope atividade.Gets or sets the Activity that makes up the body of the TransactedReceiveScope activity.

CacheId

Obtém um identificador do cache que é exclusivo no escopo da definição do fluxo de trabalho.Gets the identifier of the cache that is unique within the scope of the workflow definition.

(Herdado de Activity)
CanInduceIdle

Obtém ou define um valor que indica se a atividade pode fazer com que o fluxo de trabalho fique ocioso.Gets or sets a value that indicates whether the activity can cause the workflow to become idle.

(Herdado de NativeActivity)
Constraints

Obtém uma coleção de atividades de Constraint que podem ser configuradas para fornecer validação para a Activity.Gets a collection of Constraint activities that can be configured to provide validation for the Activity.

(Herdado de Activity)
DisplayName

Obtém ou define um nome amigável opcional que é usado para depuração, validação, manipulação de exceções e acompanhamento.Gets or sets an optional friendly name that is used for debugging, validation, exception handling, and tracking.

(Herdado de Activity)
Id

Obtém um identificador que é exclusivo no escopo da definição do fluxo de trabalho.Gets an identifier that is unique in the scope of the workflow definition.

(Herdado de Activity)
Implementation

A lógica de execução da atividade.The execution logic of the activity.

(Herdado de NativeActivity)
ImplementationVersion

Obtém ou define a versão de implementação da atividade.Gets or sets the implementation version of the activity.

(Herdado de NativeActivity)
Request

Obtém ou define o Receive atividade associada a esta TransactedReceiveScope atividade.Gets or sets the Receive activity associated with this TransactedReceiveScope activity.

Variables

Obtém a coleção de Variable associado a esta TransactedReceiveScope.Gets the collection of Variable associated with this TransactedReceiveScope.

Métodos

Abort(NativeActivityAbortContext)

Quando implementado em uma classe derivada, executa ações em resposta à atividade que está sendo anulada.When implemented in a derived class, takes actions in response to the activity being aborted.

(Herdado de NativeActivity)
CacheMetadata(ActivityMetadata)

Não implementado.Not implemented. Use o método CacheMetadata(NativeActivityMetadata) em seu lugar.Use the CacheMetadata(NativeActivityMetadata) method instead.

(Herdado de NativeActivity)
CacheMetadata(NativeActivityMetadata)

Cria e valida uma descrição dos argumentos, das variáveis, das atividades filho e dos representantes da atividade.Creates and validates a description of the activity's arguments, variables, child activities, and activity delegates.

(Herdado de NativeActivity)
Cancel(NativeActivityContext)

Quando implementado em uma classe derivada, executa a lógica para causar a conclusão antecipada normal da atividade.When implemented in a derived class, runs logic to cause graceful early completion of the activity.

(Herdado de NativeActivity)
Equals(Object)

Determina se o objeto especificado é igual ao objeto atual.Determines whether the specified object is equal to the current object.

(Herdado de Object)
Execute(NativeActivityContext)

Quando implementado em uma classe derivada, executa a lógica de execução da atividade.When implemented in a derived class, runs the activity's execution logic.

(Herdado de NativeActivity)
GetHashCode()

Serve como a função de hash padrão.Serves as the default hash function.

(Herdado de Object)
GetType()

Obtém o Type da instância atual.Gets the Type of the current instance.

(Herdado de Object)
MemberwiseClone()

Cria uma cópia superficial do Object atual.Creates a shallow copy of the current Object.

(Herdado de Object)
OnCreateDynamicUpdateMap(NativeActivityUpdateMapMetadata, Activity)

Gera um evento durante a criação de um mapa para a atualização dinâmica.Raises an event when creating a map for the dynamic update.

(Herdado de NativeActivity)
OnCreateDynamicUpdateMap(UpdateMapMetadata, Activity)

Gera um evento durante a criação de um mapa para a atualização dinâmica.Raises an event when creating a map for the dynamic update.

(Herdado de NativeActivity)
ShouldSerializeDisplayName()

Indica se a propriedade DisplayName deve ser serializada.Indicates whether the DisplayName property should be serialized.

(Herdado de Activity)
ToString()

Retorna um String que contém o Id e DisplayName do Activity.Returns a String that contains the Id and DisplayName of the Activity.

(Herdado de Activity)
UpdateInstance(NativeActivityUpdateContext)

Atualiza a instância da NativeActivity.Updates the instance of NativeActivity.

(Herdado de NativeActivity)

Aplica-se a