SendReply 类

定义

在服务端作为请求/响应消息交换模式的一部分发送答复消息的活动。

public ref class SendReply sealed : System::Activities::Activity
[System.Windows.Markup.ContentProperty("Content")]
public sealed class SendReply : System.Activities.Activity
[<System.Windows.Markup.ContentProperty("Content")>]
type SendReply = class
    inherit Activity
Public NotInheritable Class SendReply
Inherits Activity
继承
SendReply
属性

示例

下面的示例演示如何在代码中创建 SendReply 活动并将它添加到工作流。

Variable<string> message = new Variable<string> { Name = "message" };
Variable<string> echo = new Variable<string> { Name = "echo" };
Receive receiveString = new Receive
{
    OperationName = "Echo",
    ServiceContractName = "Echo",
    CanCreateInstance = true,
    //parameters for receive
    Content = new ReceiveParametersContent
    {
        Parameters = 
        {
            {"message", new OutArgument<string>(message)}
        }
    }
};

Sequence workflow = new Sequence()
{
    Variables = { message, echo },
    Activities =
        {
            receiveString,
            new WriteLine
            {
                Text = new InArgument<string>(env =>("Message received: " + message.Get(env)))
            },
            new Assign<string>
            {
                Value = new InArgument<string>(env =>("<echo> " + message.Get(env))),
                To = new OutArgument<string>(echo)
            },                        
            //parameters for reply
            new SendReply
            {                           
                Request = receiveString,                            
                Content = new SendParametersContent
                {
                    Parameters =
                    {
                        { "echo", new InArgument<string>(echo) }
                    },
                }
            },
            new WriteLine
            {
                Text = new InArgument<string>(env =>("Message sent: " + echo.Get(env)))
            },
        },
};

service = new WorkflowService
{
    Name = "Echo",
    Body = workflow
};

下面的示例演示如何用 XAML 创建 SendReply 活动并将它添加到工作流服务。

<WorkflowService mc:Ignorable="sap" ConfigurationName="Service1" Name="Service1" mva:VisualBasic.Settings="Assembly references and imported namespaces serialized as XML namespaces" xmlns="http://schemas.microsoft.com/netfx/2009/xaml/servicemodel" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mv="clr-namespace:Microsoft.VisualBasic;assembly=System" xmlns:mva="clr-namespace:Microsoft.VisualBasic.Activities;assembly=System.Activities" xmlns:p="http://schemas.microsoft.com/netfx/2009/xaml/activities" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:s1="clr-namespace:System;assembly=System" xmlns:s2="clr-namespace:System;assembly=System.Xml" xmlns:s3="clr-namespace:System;assembly=System.Core" xmlns:sad="clr-namespace:System.Activities.Debugger;assembly=System.Activities" xmlns:sap="http://schemas.microsoft.com/netfx/2009/xaml/activities/presentation" xmlns:scg="clr-namespace:System.Collections.Generic;assembly=System" xmlns:scg1="clr-namespace:System.Collections.Generic;assembly=System.ServiceModel" xmlns:scg2="clr-namespace:System.Collections.Generic;assembly=System.Core" xmlns:scg3="clr-namespace:System.Collections.Generic;assembly=mscorlib" xmlns:sd="clr-namespace:System.Data;assembly=System.Data" xmlns:sl="clr-namespace:System.Linq;assembly=System.Core" xmlns:ssa="clr-namespace:System.ServiceModel.Activities;assembly=System.ServiceModel.Activities" xmlns:st="clr-namespace:System.Text;assembly=mscorlib" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">  
  <p:Sequence sad:XamlDebuggerXmlReader.FileName="c:\Projects\WFServiceSnippets\WFServiceSnippets\Service1.xamlx" sap:VirtualizedContainerService.HintSize="277,644" mva:VisualBasic.Settings="Assembly references and imported namespaces serialized as XML namespaces">  
    <p:Sequence.Variables>  
      <p:Variable x:TypeArguments="CorrelationHandle" Name="__handle1" />  
      <p:Variable x:TypeArguments="x:String" Name="Message" />  
      <p:Variable x:TypeArguments="x:String" Name="Echo" />  
    </p:Sequence.Variables>  
    <sap:WorkflowViewStateService.ViewState>  
      <scg3:Dictionary x:TypeArguments="x:String, x:Object">  
        <x:Boolean x:Key="IsExpanded">True</x:Boolean>  
      </scg3:Dictionary>  
    </sap:WorkflowViewStateService.ViewState>  
    <Receive x:Name="__ReferenceID0" CanCreateInstance="True" DisplayName="ReceiveString" sap:VirtualizedContainerService.HintSize="255,90" OperationName="Echo" ServiceContractName="Echo">  
      <Receive.CorrelationInitializers>  
        <RequestReplyCorrelationInitializer CorrelationHandle="[__handle1]" />  
      </Receive.CorrelationInitializers>  
      <ReceiveParametersContent>  
        <p:OutArgument x:TypeArguments="x:String" x:Key="message">[Message]</p:OutArgument>  
      </ReceiveParametersContent>  
    </Receive>  
    <p:WriteLine sap:VirtualizedContainerService.HintSize="255,61" Text="[&quot;Message received: &quot; + Message]" />  
    <p:Assign sap:VirtualizedContainerService.HintSize="255,58">  
      <p:Assign.To>  
        <p:OutArgument x:TypeArguments="x:String">[Echo]</p:OutArgument>  
      </p:Assign.To>  
      <p:Assign.Value>  
        <p:InArgument x:TypeArguments="x:String">["<echo> " + Message]</p:InArgument>  
      </p:Assign.Value>  
    </p:Assign>  
    <SendReply Request="{x:Reference __ReferenceID0}" DisplayName="SendReply" sap:VirtualizedContainerService.HintSize="255,90">  
      <SendParametersContent>  
        <p:InArgument x:TypeArguments="x:String" x:Key="echo">[Echo]</p:InArgument>  
      </SendParametersContent>  
    </SendReply>  
    <p:WriteLine sap:VirtualizedContainerService.HintSize="255,61" Text="[&quot;Message sent: &quot; + Echo]" />  
  </p:Sequence>  
</WorkflowService>  

构造函数

SendReply()

初始化 SendReply 类的新实例。

属性

Action

获取或设置消息的操作标头的值。

CacheId

获取缓存的标识符,该标识符在工作流定义的作用域内是唯一的。

(继承自 Activity)
Constraints

获取可配置的 Constraint 活动的集合,用于为 Activity 提供验证。

(继承自 Activity)
Content

获取或设置 SendReply 活动发送的内容。

CorrelationInitializers

获取相关初始值设定项的集合。

DisplayName

获取或设置用于调试、验证、异常处理和跟踪的可选友好名称。

(继承自 Activity)
Id

获取一个标识符,该标识符在工作流定义的作用域内是唯一的。

(继承自 Activity)
Implementation

获取或设置返回包含执行逻辑的 Activity 的委托。

(继承自 Activity)
ImplementationVersion

获取或设置用于实现的版本。

(继承自 Activity)
PersistBeforeSend

获取或设置一个值,该值指定是否应在发送消息前保留工作流服务实例。

Request

获取或设置对与此 Receive 活动配对的 SendReply 活动的引用。

方法

CacheMetadata(ActivityMetadata)

创建并验证活动的自变量、变量、子活动和活动委托的说明。

(继承自 Activity)
Equals(Object)

确定指定对象是否等于当前对象。

(继承自 Object)
FromOperationDescription(OperationDescription, IEnumerable<SendReply>)

从给定协定操作描述中返回发送答复。

GetHashCode()

作为默认哈希函数。

(继承自 Object)
GetType()

获取当前实例的 Type

(继承自 Object)
MemberwiseClone()

创建当前 Object 的浅表副本。

(继承自 Object)
OnCreateDynamicUpdateMap(UpdateMapMetadata, Activity)

创建动态更新映射时引发事件。

(继承自 Activity)
ShouldSerializeDisplayName()

指示是否应序列化 DisplayName 属性。

(继承自 Activity)
ToString()

返回包含 StringIdDisplayNameActivity

(继承自 Activity)

适用于