SendContent.Create 方法
定义
创建一个新的 SendMessageContent 实例。Creates a new SendMessageContent instance.
重载
| Create(InArgument) |
使用指定消息创建一个新的 SendMessageContent 实例。Creates a new SendMessageContent instance with the specified message. |
| Create(IDictionary<String,InArgument>) |
使用指定的参数创建一个新的 SendParametersContent 实例。Creates a new SendParametersContent instance with the specified parameters. |
| Create(InArgument, Type) |
使用指定的消息和消息类型创建新 SendMessageContent 实例。Creates a new SendMessageContent instance with the specified message and message type. |
Create(InArgument)
使用指定消息创建一个新的 SendMessageContent 实例。Creates a new SendMessageContent instance with the specified message.
public:
static System::ServiceModel::Activities::SendMessageContent ^ Create(System::Activities::InArgument ^ message);
public static System.ServiceModel.Activities.SendMessageContent Create (System.Activities.InArgument message);
static member Create : System.Activities.InArgument -> System.ServiceModel.Activities.SendMessageContent
Public Shared Function Create (message As InArgument) As SendMessageContent
参数
- message
- InArgument
要发送的数据。The data to send.
返回
一个 SendMessageContent 实例。A SendMessageContent instance.
示例
下面的示例演示如何使用 SendContent 类指定 SendMessageContent 活动的 SendReply。The following example shows how to use the SendContent class to specify the SendMessageContent for a SendReply activity. 此示例使用 lambda 表达式指定 InArgument。This example uses a lambda expression to specify the InArgument. 有关 lambda 表达式的详细信息,请参阅 Lambda 表达式For more information about lambda expressions, see Lambda Expressions
new SendReply
{
Request = submitPO,
Content = SendContent.Create(new InArgument<int>( (e) => po.Get(e).Id)), // creates a SendMessageContent
CorrelationInitializers =
{
new QueryCorrelationInitializer
{
// initializes a correlation based on the PurchaseOrder Id sent in the reply message and stores it in the handle
CorrelationHandle = poidHandle,
MessageQuerySet = new MessageQuerySet
{
// int is the name of the parameter being sent in the outgoing response
{ "PoId", new XPathMessageQuery("sm:body()/ser:int", Constants.XPathMessageContext) }
}
}
}
},
适用于
Create(IDictionary<String,InArgument>)
使用指定的参数创建一个新的 SendParametersContent 实例。Creates a new SendParametersContent instance with the specified parameters.
public:
static System::ServiceModel::Activities::SendParametersContent ^ Create(System::Collections::Generic::IDictionary<System::String ^, System::Activities::InArgument ^> ^ parameters);
public static System.ServiceModel.Activities.SendParametersContent Create (System.Collections.Generic.IDictionary<string,System.Activities.InArgument> parameters);
static member Create : System.Collections.Generic.IDictionary<string, System.Activities.InArgument> -> System.ServiceModel.Activities.SendParametersContent
Public Shared Function Create (parameters As IDictionary(Of String, InArgument)) As SendParametersContent
参数
- parameters
- IDictionary<String,InArgument>
名称/值对的集合,其中键包含参数名称,值包含自变量。A collection of name/value pairs with the keys containing the parameter names and the values containing the arguments.
返回
一个 SendParametersContent 实例。A SendParametersContent instance.
适用于
Create(InArgument, Type)
使用指定的消息和消息类型创建新 SendMessageContent 实例。Creates a new SendMessageContent instance with the specified message and message type.
public:
static System::ServiceModel::Activities::SendMessageContent ^ Create(System::Activities::InArgument ^ message, Type ^ declaredMessageType);
public static System.ServiceModel.Activities.SendMessageContent Create (System.Activities.InArgument message, Type declaredMessageType);
static member Create : System.Activities.InArgument * Type -> System.ServiceModel.Activities.SendMessageContent
Public Shared Function Create (message As InArgument, declaredMessageType As Type) As SendMessageContent
参数
- message
- InArgument
要发送的数据。The data to send.
- declaredMessageType
- Type
将在服务说明和 WSDL 中显示的数据类型。The data type that will appear in the service description and WSDL. 它必须与消息的自变量类型或其基类型相同。It must be either the same as the argument type of the message or its base type.
返回
一个 SendMessageContent 实例。A SendMessageContent instance.
注解
有关已声明消息类型的详细信息,请参阅 DeclaredMessageType 。For more information about the declared message type, see DeclaredMessageType.