PersistenceParticipant Classe
Definição
Essa classe permite que ambos WorkflowApplication e WorkflowServiceHost participem no processo de persistência.This class allows both WorkflowApplication and WorkflowServiceHost to participate in persistence process. Um participante de persistência deriva da classe PersistenceParticipant ou PersistenceIOParticipant (classe derivada da classe PersistenceParticipant), implementa métodos abstratos e adiciona uma instância da classe como uma extensão da instância do fluxo de trabalho.A persistence participant derives from the PersistenceParticipant class or the PersistenceIOParticipant class (derived class of the PersistenceParticipant class), implements abstract methods, and then add an instance of the class as a workflow instance extension. O WorkflowApplication e WorkflowServiceHost procuram por tais extensões ao persistirem uma instância e invocarem os métodos apropriados em momentos apropriados.The WorkflowApplication and WorkflowServiceHost look for such extensions when persisting an instance and invoke appropriate methods at appropriate times.
public ref class PersistenceParticipant abstract
public abstract class PersistenceParticipant
type PersistenceParticipant = class
Public MustInherit Class PersistenceParticipant
- Herança
-
PersistenceParticipant
- Derivado
Exemplos
O exemplo de código a seguir demonstra como criar uma classe derivada de PersistenceParticipant .The following code sample demonstrates creating a class that derives from PersistenceParticipant. Este exemplo é do exemplo de processo de contratação .This example is from the Hiring Process sample.
public class HiringRequestInfoPersistenceParticipant: PersistenceIOParticipant
{
public HiringRequestInfoPersistenceParticipant()
: base(true, false)
{
}
Comentários
Um host executa as seguintes etapas (ou estágios) ao persistir uma instância:A host executes the following steps (or stages) when persisting an instance:
Coleta valores a serem persistidos.Collects values to be persisted.
Mapeia campos de valores estruturados monolíticos para valores individuais.Maps fields of monolithic structured values to individual values.
Emite o SaveWorkflowCommand para o provedor de persistência.Issues the SaveWorkflowCommand to the persistence provider.
Executa a e/s na transação de persistência.Performs I/O under the persistence transaction.
Um host conclui um estágio antes de iniciar o próximo estágio.A host completes a stage before beginning the next stage. Por exemplo, ao persistir, o host coleta valores de todos os participantes da persistência antes de passar para o segundo estágio.For example when persisting, the host collects values from all the persistence participants before moving to the second stage. No segundo estágio, o host fornece todos os valores coletados no primeiro estágio para todos os participantes da persistência no segundo estágio para mapeamento.In the second stage, the host provides all the values collected in the first stage to all persistence participants in the second stage for mapping. No terceiro estágio, o host fornece todos os valores coletados no primeiro e segundo estágios para o provedor de persistência ao invocar o SaveWorkflowCommand .In the third stage, the host provides all the collected values in the first and second stages to the persistence provider when invoking the SaveWorkflowCommand. Em seguida, no quarto estágio, o host fornece todos os valores coletados para todos os participantes de e/s de persistência na transação de persistência.Then in the fourth stage, the host provides all the collected values to all the persistence IO participants under the persistence transaction.
Um host executa os seguintes estágios ao carregar uma instância de persistência:A host executes the following stages when loading a persistence instance:
Emite o LoadWorkflowCommand e o LoadWorkflowByInstanceKeyCommand para o provedor de persistência.Issues the LoadWorkflowCommand and LoadWorkflowByInstanceKeyCommand to the persistence provider.
Executa a e/s na transação de persistência.Performs I/O under the persistence transaction.
Publica os valores carregados.Publishes the loaded values.
No nível mais alto, as extensões de instância de fluxo de trabalho que derivam da PersistenceParticipant classe podem participar dos primeiros (coletar) e segundo (mapa) estágios do processo de persistência e o terceiro estágio (publicação) do processo de carregamento.At the highest level, workflow instance extensions that derive from the PersistenceParticipant class can participate in the first (Collect) and second (Map) stages of persisting process and the third stage (Publish) of loading process. As extensões de instância de fluxo de trabalho derivadas da classe PersistenceIOParticipant também podem participar do quarto estágio do processo de persistência e o segundo estágio do processo de carregamento (e/s).Workflow instance extensions deriving from the PersistenceIOParticipant class can additionally participate in the fourth stage of the persisting process and the second stage of the loading process (I/O).
Construtores
| PersistenceParticipant() |
Inicializa uma instância da classe PersistenceParticipant.Initializes an instance of the PersistenceParticipant class. |
Métodos
| CollectValues(IDictionary<XName,Object>, IDictionary<XName,Object>) |
Um host invoca esse método em um participante de persistência personalizado para coletar valores de leitura/gravação e valores somente gravação a serem persistidos.A host invokes this method on a custom persistence participant to collect read-write values and write-only values, to be persisted. |
| 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) |
| 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) |
| MapValues(IDictionary<XName,Object>, IDictionary<XName,Object>) |
Um host invoca este método depois de concluir a coleta de valores no primeiro estágio.A host invokes this method after it is done with collecting the values in the first stage. O host encaminha dois dicionários somente leitura dos valores que coletou de todos os participantes da persistência durante o primeiro estágio (estágio CollectValues) a este método para mapeamento.The host forwards two read-only dictionaries of values it collected from all persistence participants during the first stage (CollectValues stage) to this method for mapping. O host adiciona os valores contidos no dicionário retornado por esse método à coleção de valores somente gravação.The host adds values in the dictionary returned by this method to the collection of write-only values. |
| MemberwiseClone() |
Cria uma cópia superficial do Object atual.Creates a shallow copy of the current Object. (Herdado de Object) |
| PublishValues(IDictionary<XName,Object>) |
O host invoca esse método e passa todos os valores carregados na coleção InstanceData (preenchidos pelo LoadWorkflowCommand ou LoadWorkflowByInstanceKeyCommand) como um parâmetro de dicionário.The host invokes this method and passes all the loaded values in the InstanceData collection (filled by the LoadWorkflowCommand or LoadWorkflowByInstanceKeyCommand) as a dictionary parameter. |
| ToString() |
Retorna uma cadeia de caracteres que representa o objeto atual.Returns a string that represents the current object. (Herdado de Object) |