WorkflowHostingResponseContext Classe

Definizione

Questa classe viene utilizzata insieme alla classe WorkflowHostingEndpoint. Si utilizza per l'invio della risposta per un contratto request/reply supportato da un'implementazione WorkflowHostingEndpoint.

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

Esempio

L'esempio seguente mostra in che modo viene fornito un oggetto WorkflowHostingResponseContext a un endpoint che ospita il 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

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 l'oggetto Type dell'istanza corrente.

(Ereditato da Object)
MemberwiseClone()

Crea una copia superficiale dell'oggetto Object corrente.

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

Invia una risposta a un messaggio inviato a WorkflowHostingEndpoint.

ToString()

Restituisce una stringa che rappresenta l'oggetto corrente.

(Ereditato da Object)

Si applica a