While 构造函数
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
创建 While 活动的新实例。
重载
While() |
创建 While 活动的新实例。 |
While(Activity<Boolean>) |
创建 While 活动的新实例。 |
While(Expression<Func<ActivityContext,Boolean>>) |
创建 While 活动的新实例。 |
示例
下面的代码示例演示如何创建 While 活动。
new While
{
Condition = true,
Body = new Receive
{
ServiceContractName = Constants.POContractName,
OperationName = Constants.UpdatePOName,
CorrelatesWith = poidHandle, // identifies that the UpdatePO operation is waiting on the PurchaseOrderId that was used to initialize this handle
CorrelatesOn = new MessageQuerySet // the query that is used on an incoming message to find the requisite PurchaseOrderId specified in the correlation
{
// Id is the name of the incoming parameter within the PurchaseOrder
{ "PoId", new XPathMessageQuery("sm:body()/defns:PurchaseOrder/defns:Id", Constants.XPathMessageContext) }
},
Content = ReceiveContent.Create(new OutArgument<PurchaseOrder>(po)) // creates a ReceiveMessageContent
}
},
While()
创建 While 活动的新实例。
public:
While();
public While ();
Public Sub New ()
示例
下面的代码示例演示如何创建 While 活动。
new While
{
Condition = true,
Body = new Receive
{
ServiceContractName = Constants.POContractName,
OperationName = Constants.UpdatePOName,
CorrelatesWith = poidHandle, // identifies that the UpdatePO operation is waiting on the PurchaseOrderId that was used to initialize this handle
CorrelatesOn = new MessageQuerySet // the query that is used on an incoming message to find the requisite PurchaseOrderId specified in the correlation
{
// Id is the name of the incoming parameter within the PurchaseOrder
{ "PoId", new XPathMessageQuery("sm:body()/defns:PurchaseOrder/defns:Id", Constants.XPathMessageContext) }
},
Content = ReceiveContent.Create(new OutArgument<PurchaseOrder>(po)) // creates a ReceiveMessageContent
}
},
适用于
While(Activity<Boolean>)
创建 While 活动的新实例。
public:
While(System::Activities::Activity<bool> ^ condition);
public While (System.Activities.Activity<bool> condition);
new System.Activities.Statements.While : System.Activities.Activity<bool> -> System.Activities.Statements.While
Public Sub New (condition As Activity(Of Boolean))
参数
适用于
While(Expression<Func<ActivityContext,Boolean>>)
创建 While 活动的新实例。
public:
While(System::Linq::Expressions::Expression<Func<System::Activities::ActivityContext ^, bool> ^> ^ condition);
public While (System.Linq.Expressions.Expression<Func<System.Activities.ActivityContext,bool>> condition);
new System.Activities.Statements.While : System.Linq.Expressions.Expression<Func<System.Activities.ActivityContext, bool>> -> System.Activities.Statements.While
Public Sub New (condition As Expression(Of Func(Of ActivityContext, Boolean)))
参数
- condition
- Expression<Func<ActivityContext,Boolean>>
活动依据其进行迭代的条件。