語言

WorkflowHostingResponseContext 類別

定義

此類別與類別 WorkflowHostingEndpoint 同時使用。 它用於傳送由實作支持 WorkflowHostingEndpoint 的請求/回覆合約的回應。

public ref class WorkflowHostingResponseContext sealed
public sealed class WorkflowHostingResponseContext
type WorkflowHostingResponseContext = class
Public NotInheritable Class WorkflowHostingResponseContext
繼承
WorkflowHostingResponseContext

範例

以下範例說明如何提供 a WorkflowHostingResponseContext 給工作流程主機端點。

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;
}

方法

名稱 Description
Equals(Object)

判斷指定的物件是否等於目前的物件。

(繼承來源 Object)
GetHashCode()

做為預設哈希函式。

(繼承來源 Object)
GetType()

取得目前實例的 Type。

(繼承來源 Object)
MemberwiseClone()

建立目前 Object的淺層複本。

(繼承來源 Object)
SendResponse(Object, Object[])

回覆發送到的 WorkflowHostingEndpoint訊息。

ToString()

傳回表示目前 物件的字串。

(繼承來源 Object)

適用於