CorrelationScope 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
对子消息传递活动进行隐式 CorrelationHandle 管理。
public ref class CorrelationScope : System::Activities::NativeActivity
public class CorrelationScope : System.Activities.NativeActivity
type CorrelationScope = class
inherit NativeActivity
Public Class CorrelationScope
Inherits NativeActivity
- 继承
示例
下面的示例演示如何创建一个 CorrelationScope。 本示例创建 Sequence 并添加 CorrelationScope 其他活动) (。 CorrelationScope 包含一个 Sequence,后者由 Send 和 ReceiveReply 活动组成。
return new Sequence
{
Variables = { po, customer },
Activities =
{
new Assign<PurchaseOrder>
{
To = po,
Value = new InArgument<PurchaseOrder>( (e) => new PurchaseOrder() { PartName = "Widget", Quantity = 150 } )
},
new Assign<Customer>
{
To = customer,
Value = new InArgument<Customer>( (e) => new Customer() { Id = 12345678, Name = "John Smith" } )
},
new WriteLine { Text = new InArgument<string>( (e) => string.Format("Submitting new PurchaseOrder for {0} {1}s", po.Get(e).Quantity, po.Get(e).PartName) ) },
new CorrelationScope
{
Body = new Sequence
{
Activities =
{
submitPO,
new ReceiveReply
{
Request = submitPO,
Content = ReceiveContent.Create(new OutArgument<int>( (e) => po.Get(e).Id ))
}
}
}
},
new WriteLine { Text = new InArgument<string>( (e) => string.Format("Received ID for new PO: {0}", po.Get(e).Id) ) },
new Assign<int> { To = new OutArgument<int>( (e) => po.Get(e).Quantity ), Value = 250 },
new WriteLine { Text = "Updated PO with new quantity: 250. Resubmitting updated PurchaseOrder based on POId." },
new Send
{
Endpoint = clientEndpoint,
ServiceContractName = Constants.POContractName,
OperationName = Constants.UpdatePOName,
Content = SendContent.Create(new InArgument<PurchaseOrder>(po))
},
new Assign<int>
{
To = new OutArgument<int>( (e) => po.Get(e).CustomerId ),
Value = new InArgument<int>( (e) => customer.Get(e).Id )
},
new WriteLine { Text = "Updating customer data based on CustomerId." },
new Send
{
Endpoint = clientEndpoint,
ServiceContractName = Constants.POContractName,
OperationName = Constants.AddCustomerInfoName,
Content = SendContent.Create(new InArgument<PurchaseOrder>(po))
},
new Send
{
Endpoint = clientEndpoint,
ServiceContractName = Constants.POContractName,
OperationName = Constants.UpdateCustomerName,
Content = SendContent.Create(new InArgument<Customer>(customer))
},
new WriteLine { Text = "Client completed." }
}
};
注解
CorrelationScope 活动维护一个仅对子活动可见的隐式 CorrelationHandle。 当用户设置 CorrelatesWith 属性时,它将用作 CorrelationScope 隐式句柄。 对于嵌套 CorrelationScope,内部范围的子项无法访问外部范围的隐式句柄。
构造函数
CorrelationScope() |
初始化 CorrelationScope 类的新实例。 |
属性
Body |
获取或设置活动的执行逻辑。 |
CacheId |
获取缓存的标识符,该标识符在工作流定义的作用域内是唯一的。 (继承自 Activity) |
CanInduceIdle |
获取或设置一个值,该值指示活动是否会使工作流进入空闲状态。 (继承自 NativeActivity) |
Constraints |
获取可配置的 Constraint 活动的集合,用于为 Activity 提供验证。 (继承自 Activity) |
CorrelatesWith |
获取或设置子消息传递活动使用的 CorrelationHandle。 |
DisplayName |
获取或设置用于调试、验证、异常处理和跟踪的可选友好名称。 (继承自 Activity) |
Id |
获取一个标识符,该标识符在工作流定义的作用域内是唯一的。 (继承自 Activity) |
Implementation |
活动的执行逻辑。 (继承自 NativeActivity) |
ImplementationVersion |
获取或设置活动的实现版本。 (继承自 NativeActivity) |