CallExternalMethodActivity 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
注意
The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*
定义用于对本地服务调用方法的工作流通信活动。 此活动用于将数据通过本地服务从工作流发送到宿主中。
public ref class CallExternalMethodActivity : System::Workflow::ComponentModel::Activity, System::Workflow::ComponentModel::IDynamicPropertyTypeProvider
[System.Workflow.ComponentModel.Compiler.ActivityValidator(typeof(System.Workflow.Activities.CallExternalMethodActivityValidator))]
public class CallExternalMethodActivity : System.Workflow.ComponentModel.Activity, System.Workflow.ComponentModel.IDynamicPropertyTypeProvider
[System.Workflow.ComponentModel.Compiler.ActivityValidator(typeof(System.Workflow.Activities.CallExternalMethodActivityValidator))]
[System.Obsolete("The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*")]
public class CallExternalMethodActivity : System.Workflow.ComponentModel.Activity, System.Workflow.ComponentModel.IDynamicPropertyTypeProvider
[<System.Workflow.ComponentModel.Compiler.ActivityValidator(typeof(System.Workflow.Activities.CallExternalMethodActivityValidator))>]
type CallExternalMethodActivity = class
inherit Activity
interface IDynamicPropertyTypeProvider
[<System.Workflow.ComponentModel.Compiler.ActivityValidator(typeof(System.Workflow.Activities.CallExternalMethodActivityValidator))>]
[<System.Obsolete("The System.Workflow.* types are deprecated. Instead, please use the new types from System.Activities.*")>]
type CallExternalMethodActivity = class
inherit Activity
interface IDynamicPropertyTypeProvider
Public Class CallExternalMethodActivity
Inherits Activity
Implements IDynamicPropertyTypeProvider
- 继承
- 属性
- 实现
示例
下面的代码示例演示如何在自定义活动中使用 CallExternalMethodActivity 调用外部方法。 此代码示例摘自 PurchaseOrderWorkflow.Designer.cs 文件中的“侦听”SDK 示例。 有关详细信息,请参阅 侦听示例。
[System.Diagnostics.DebuggerNonUserCode()]
private void InitializeComponent()
{
this.CanModifyActivities = true;
this.Timeout = new System.Workflow.Activities.CodeActivity();
this.Delay = new System.Workflow.Activities.DelayActivity();
this.RejectPO = new System.Workflow.Activities.HandleExternalEventActivity();
this.ApprovePO = new System.Workflow.Activities.HandleExternalEventActivity();
this.OnTimeoutEventDriven = new System.Workflow.Activities.EventDrivenActivity();
this.OnOrderRejectedEventDriven = new System.Workflow.Activities.EventDrivenActivity();
this.OnOrderApprovedEventDriven = new System.Workflow.Activities.EventDrivenActivity();
this.POStatusListen = new System.Workflow.Activities.ListenActivity();
this.CreatePO = new System.Workflow.Activities.CallExternalMethodActivity();
//
// Timeout
//
this.Timeout.Name = "Timeout";
this.Timeout.ExecuteCode += new System.EventHandler(this.OnTimeout);
//
// Delay
//
this.Delay.Name = "Delay";
this.Delay.TimeoutDuration = System.TimeSpan.Parse("00:00:05");
//
// RejectPO
//
this.RejectPO.EventName = "OrderRejected";
this.RejectPO.InterfaceType = typeof(IOrderService);
this.RejectPO.Name = "RejectPO";
this.RejectPO.Invoked += new System.EventHandler<System.Workflow.Activities.ExternalDataEventArgs>(this.OnRejectPO);
//
// ApprovePO
//
this.ApprovePO.EventName = "OrderApproved";
this.ApprovePO.InterfaceType = typeof(IOrderService);
this.ApprovePO.Name = "ApprovePO";
this.ApprovePO.Invoked += new System.EventHandler<System.Workflow.Activities.ExternalDataEventArgs>(this.OnApprovePO);
//
// OnTimeoutEventDriven
//
this.OnTimeoutEventDriven.Activities.Add(this.Delay);
this.OnTimeoutEventDriven.Activities.Add(this.Timeout);
this.OnTimeoutEventDriven.Name = "OnTimeoutEventDriven";
//
// OnOrderRejectedEventDriven
//
this.OnOrderRejectedEventDriven.Activities.Add(this.RejectPO);
this.OnOrderRejectedEventDriven.Name = "OnOrderRejectedEventDriven";
//
// OnOrderApprovedEventDriven
//
this.OnOrderApprovedEventDriven.Activities.Add(this.ApprovePO);
this.OnOrderApprovedEventDriven.Name = "OnOrderApprovedEventDriven";
//
// POStatusListen
//
this.POStatusListen.Activities.Add(this.OnOrderApprovedEventDriven);
this.POStatusListen.Activities.Add(this.OnOrderRejectedEventDriven);
this.POStatusListen.Activities.Add(this.OnTimeoutEventDriven);
this.POStatusListen.Name = "POStatusListen";
//
// CreatePO
//
this.CreatePO.InterfaceType = typeof(IOrderService);
this.CreatePO.MethodName = "CreateOrder";
this.CreatePO.Name = "CreatePO";
this.CreatePO.MethodInvoking += new System.EventHandler(this.OnBeforeCreateOrder);
//
// PurchaseOrderWorkflow
//
this.Activities.Add(this.CreatePO);
this.Activities.Add(this.POStatusListen);
this.Name = "PurchaseOrderWorkflow";
this.CanModifyActivities = false;
}
<System.Diagnostics.DebuggerNonUserCode()> _
Private Sub InitializeComponent()
Me.CanModifyActivities = True
Me.CreatePO = New System.Workflow.Activities.CallExternalMethodActivity
Me.POStatusListen = New System.Workflow.Activities.ListenActivity
Me.OnOrderApprovedEventDriven = New System.Workflow.Activities.EventDrivenActivity
Me.OnOrderRejectedEventDriven = New System.Workflow.Activities.EventDrivenActivity
Me.OnTimeoutEventDriven = New System.Workflow.Activities.EventDrivenActivity
Me.ApprovePO = New System.Workflow.Activities.HandleExternalEventActivity
Me.RejectPO = New System.Workflow.Activities.HandleExternalEventActivity
Me.Delay = New System.Workflow.Activities.DelayActivity
Me.Timeout = New System.Workflow.Activities.CodeActivity
'
'Timeout
'
Me.Timeout.Name = "Timeout"
AddHandler Me.Timeout.ExecuteCode, AddressOf Me.OnTimeout
'
'Delay
'
Me.Delay.Name = "Delay"
Me.Delay.TimeoutDuration = System.TimeSpan.Parse("00:00:05")
'
'RejectPO
'
Me.RejectPO.EventName = "OrderRejected"
Me.RejectPO.InterfaceType = GetType(IOrderService)
Me.RejectPO.Name = "RejectPO"
AddHandler Me.RejectPO.Invoked, AddressOf Me.OnRejectPO
'
' ApprovePO
'
Me.ApprovePO.EventName = "OrderApproved"
Me.ApprovePO.InterfaceType = GetType(IOrderService)
Me.ApprovePO.Name = "ApprovePO"
AddHandler Me.ApprovePO.Invoked, AddressOf Me.OnApprovePO
'
' OnTimeoutEventDriven
'
Me.OnTimeoutEventDriven.Activities.Add(Me.Delay)
Me.OnTimeoutEventDriven.Activities.Add(Me.Timeout)
Me.OnTimeoutEventDriven.Name = "OnTimeoutEventDriven"
'
' OnOrderRejectedEventDriven
'
Me.OnOrderRejectedEventDriven.Activities.Add(Me.RejectPO)
Me.OnOrderRejectedEventDriven.Name = "OnOrderRejectedEventDriven"
'
' OnOrderApprovedEventDriven
'
Me.OnOrderApprovedEventDriven.Activities.Add(Me.ApprovePO)
Me.OnOrderApprovedEventDriven.Name = "OnOrderApprovedEventDriven"
'
' POStatusListen
'
Me.POStatusListen.Activities.Add(Me.OnOrderApprovedEventDriven)
Me.POStatusListen.Activities.Add(Me.OnOrderRejectedEventDriven)
Me.POStatusListen.Activities.Add(Me.OnTimeoutEventDriven)
Me.POStatusListen.Name = "POStatusListen"
'
' CreatePO
'
Me.CreatePO.InterfaceType = GetType(IOrderService)
Me.CreatePO.MethodName = "CreateOrder"
Me.CreatePO.Name = "CreatePO"
AddHandler Me.CreatePO.MethodInvoking, AddressOf Me.OnBeforeCreateOrder
'
' PurchaseOrderWorkflow
'
Me.Activities.Add(Me.CreatePO)
Me.Activities.Add(Me.POStatusListen)
Me.Name = "PurchaseOrderWorkflow"
Me.CanModifyActivities = False
End Sub
注解
注意
本材料讨论的类型和命名空间已废弃不用。 有关详细信息,请参阅 Windows Workflow Foundation 4.5 中弃用的类型。
本地服务是一个类,该类实现本地服务接口(使用 ExternalDataExchangeAttribute 标记的接口)并被添加到 ExternalDataExchangeService。
注意
当调用外部方法时,会克隆该方法的所有参数。 如果参数类型实现 ICloneable,则 Clone
调用 方法或使用 进行序列化和反序列化 BinaryFormatter。
构造函数
CallExternalMethodActivity() |
已过时.
初始化 CallExternalMethodActivity 类的新实例。 |
CallExternalMethodActivity(String) |
已过时.
使用活动名初始化 CallExternalMethodActivity 类的新实例。 |
字段
CorrelationTokenProperty |
已过时.
表示针对 DependencyProperty 属性的 CorrelationToken。 |
InterfaceTypeProperty |
已过时.
表示针对 DependencyProperty 属性的 InterfaceType。 |
MethodInvokingEvent |
已过时.
表示针对 DependencyProperty 事件的 MethodInvoking。 |
MethodNameProperty |
已过时.
表示针对 DependencyProperty 属性的 MethodName。 |
ParameterBindingsProperty |
已过时.
表示针对 DependencyProperty 属性的 ParameterBindings。 |
属性
方法
事件
Canceling |
已过时.
在取消活动执行时发生。 (继承自 Activity) |
Closed |
已过时.
在 Activity 完成执行时发生。 (继承自 Activity) |
Compensating |
已过时.
在 Activity 上运行补偿方法时发生。 (继承自 Activity) |
Executing |
已过时.
在运行 Activity 时发生。 (继承自 Activity) |
Faulting |
已过时.
在实例的运行期间引发异常时发生。 (继承自 Activity) |
MethodInvoking |
已过时.
在调用方法前发生。 |
StatusChanged |
已过时.
在运行中的 ActivityExecutionStatus 的 Activity 更改时发生。 (继承自 Activity) |
显式接口实现
IComponent.Disposed |
已过时.
表示处理组件的“Disposed”事件的方法。 (继承自 DependencyObject) |
IDynamicPropertyTypeProvider.GetAccessType(IServiceProvider, String) |
已过时.
返回指定属性的访问类型。 |
IDynamicPropertyTypeProvider.GetPropertyType(IServiceProvider, String) |
已过时.
返回指定属性的 Type。 |