WorkflowHostingResponseContext Classe

Definizione

Questa classe viene usata insieme alla WorkflowHostingEndpoint classe . Viene usato per inviare la risposta per un contratto di richiesta/risposta supportato da un'implementazione WorkflowHostingEndpoint .

public ref class WorkflowHostingResponseContext sealed
public sealed class WorkflowHostingResponseContext
type WorkflowHostingResponseContext = class
Public NotInheritable Class WorkflowHostingResponseContext
Ereditarietà
WorkflowHostingResponseContext

Esempio

Nell'esempio seguente viene illustrato come viene fornito un oggetto WorkflowHostingResponseContext a un endpoint di hosting del flusso di lavoro.

protected override WorkflowCreationContext OnGetCreationContext(object[] inputs, OperationContext operationContext, Guid instanceId, WorkflowHostingResponseContext responseContext)
{
    WorkflowCreationContext creationContext = new WorkflowCreationContext();
    if (operationContext.IncomingMessageHeaders.Action.EndsWith("Create"))
    {
        Dictionary<string, object> arguments = (Dictionary<string, object>)inputs[0];
        if (arguments != null && arguments.Count > 0)
        {
            foreach (KeyValuePair<string, object> pair in arguments)
            {
                //arguments to pass to the workflow
                creationContext.WorkflowArguments.Add(pair.Key, pair.Value);
            }
        }
        //reply to client with instanceId
        responseContext.SendResponse(instanceId, null);
    }
    else if (operationContext.IncomingMessageHeaders.Action.EndsWith("CreateWithInstanceId"))
    {
        Dictionary<string, object> arguments = (Dictionary<string, object>)inputs[0];
        if (arguments != null && arguments.Count > 0)
        {
            foreach (KeyValuePair<string, object> pair in arguments)
            {
                //arguments to pass to workflow
                creationContext.WorkflowArguments.Add(pair.Key, pair.Value);
            }
        }
    }
    else
    {
        throw new InvalidOperationException("Invalid Action: " + operationContext.IncomingMessageHeaders.Action);
    }
    return creationContext;
}

Metodi

Nome Descrizione
Equals(Object)

Determina se l'oggetto specificato è uguale all'oggetto corrente.

(Ereditato da Object)
GetHashCode()

Funge da funzione hash predefinita.

(Ereditato da Object)
GetType()

Ottiene il Type dell'istanza corrente.

(Ereditato da Object)
MemberwiseClone()

Crea una copia superficiale del Objectcorrente.

(Ereditato da Object)
SendResponse(Object, Object[])

Invia la risposta a un messaggio inviato all'oggetto WorkflowHostingEndpoint.

ToString()

Restituisce una stringa che rappresenta l'oggetto corrente.

(Ereditato da Object)

Si applica a