ImageVerifierCode 换一换
格式:DOCX , 页数:27 ,大小:105.91KB ,
资源ID:9222794      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/9222794.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(WorkflowRuntime WorkflowInstance.docx)为本站会员(b****7)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

WorkflowRuntime WorkflowInstance.docx

1、WorkflowRuntime WorkflowInstanceWorkflowRuntime与宿主,服务,工作流模板类,设计器,实例的关系WorkflowRuntime与WWF的结构WorkflowRuntime基本运行图WorkflowRuntime与加载服务WorkflowRuntime介绍System.Workflow.Runtime.WorkflowRuntime文件: system.workflow.runtime.dll在工作流的运行环境(宿主)中,为工作流提供运行的引擎1WorkflowRuntime在宿主中以自已独立的线程运行例2WorkflowRuntime可以加载多个工作

2、流实例,每个工作流实例在WorkflowRuntime有独立的线程3.同一宿主可可以实例化多个引擎,他们可以同时工作基本使用配置并启动引擎Dim 引擎 As New WorkflowRuntime() 定义引擎实例引擎.AddService(加载服务)向引擎加载服务AddHandler 引擎.事件, AddressOf 事件回调程序 为引擎绑定事件引擎.StartRuntime() 启动引擎在引擎中创建并运行实例Dim 工作流模板类As Type 定义一个Type型对象工作流模板类= GetType(Workflow1) 得要要运行的工作流的类型名Dim 实例 As WorkflowInsta

3、nce 定义一个要由引擎运行的工作流实例用引擎.CreateWorkflow方法返回实例,此时该实例已在引擎内创建,但还没启动实例= 引擎.CreateWorkflow(工作流模板类)实例.Start() 运行引擎中的实例停止引擎停止引擎引擎.StopRuntime()方法加载服务得到服务AddService添加一个服务到工作流引擎 引擎.AddService (object)RemoveService从工作流引擎移除一个服务 引擎.RemoveService(object) GetService从加载到引擎中的指定服务Function GetService (serviceType As T

4、ype) As ObjectFunction GetService(Of T)() As TGetAllServices得到所有加载到引擎中的服务Function GetAllServices(Of T) As ReadOnlyCollection(Of T)Function GetAllServices (serviceType As Type) As ReadOnlyCollection(Of Object)建立实例得到实例CreateWorkflow在引擎中建立一个实例,并将该实例返回使用工作流类开为参数Function CreateWorkflow ( workflowType As

5、Type ) As WorkflowInstanceFunction CreateWorkflow (workflowType As Type,参数 As Dictionary(Of String, Object) As WorkflowInstance使用一个XmlReader为参数Function CreateWorkflow(ByVal workflowDefinitionReader As XmlReader) As WorkflowInstanceFunction CreateWorkflow(ByVal workflowDefinitionReader As XmlReader,

6、ByVal rulesReader As XmlReader, ByVal 参数As Dictionary(Of String, Object) As WorkflowInstanceGetLoadedWorkflows得到内存中所有工作流的集合 Function GetLoadedWorkflows As ReadOnlyCollection(Of WorkflowInstance)GetWorkflow使用 Guid参数,从引擎中得到指定ID的工作流实例 Function GetWorkflow(ByVal instanceId As Guid) As WorkflowInstance如果

7、引擎中没有指定GUID的实例,会报The workflow hosting environment does not have a persistence service as required by an operation on the workflow instance如果加载了SqlWorkflowPersistenceService,没有所引的实例会报Workflow with id GUID not found in state persistence store.引擎控制StartRuntime启用引擎引擎.StartRuntime() StopRuntime停止引擎,停止引擎后

8、,引擎停止后,引擎并没有释放,引擎中的实例也存在,只是所有的执行都被系统级挂起,当重新启动引擎时,所有的实例还可继续运行引擎.StopRuntime()资源释放Dispose释放工作流引擎资源引擎.Dispose()事件ByVal sender As Object返回引发该事件的工作流引擎,当一个宿主实例化了多个引擎,而这些引擎又绑定到同一组事件上时,可以使用sender参数得到触发该事件的引擎ServicesException_NotHandled Occurs when a service that is derived from the WorkflowRuntimeService cl

9、ass calls RaiseServicesExceptionNotHandledEvent(与加载服务有关) Sub OnServicesExceptionNotHandled(ByVal sender As Object, ByVal e As ServicesExceptionNotHandledEventArgs) ServicesExceptionNotHandledEventArgs e.Exception异常信息 e.WorkflowInstanceId 工作流实例的GUIDStarted引擎启动后 Sub OnStarted(ByVal sender As Object, B

10、yVal e As WorkflowRuntimeEventArgs) WorkflowRuntimeEventArgs e.IsStarted 是否启动Stopped引擎停止后 Sub OnStopped(ByVal sender As Object, ByVal e As WorkflowRuntimeEventArgs) WorkflowRuntimeEventArgs e.IsStarted 是否启动WorkflowAborted引擎中的某个实例:被中断执行后 Sub OnWorkflowAborted(ByVal sender As Object, ByVal e As Workfl

11、owEventArgs) WorkflowEventArgs e.WorkflowInstance 工作流实例WorkflowCompleted引擎中的某个实例:完成后. Sub OnWorkflowCompleted(ByVal sender As Object, ByVal e As WorkflowCompletedEventArgs) WorkflowCompletedEventArgs e.OutputParameters用参数方式与实例的属性进行通信 e.WorkflowInstance 工作流实例 e.WorkflowInstance 引发该事件的实例WorkflowCreate

12、d引擎中的某个实例: 被创建后 Sub OnWorkflowCreated(ByVal sender As Object, ByVal e As WorkflowEventArgs) WorkflowEventArgs e.WorkflowInstance 工作流实例WorkflowIdled引擎中的某个实例: 进入空闭状态, 如Delay控件,CallExternalMethod控件,会触发该事件 Sub OnWorkflowIdled(ByVal sender As Object, ByVal e As WorkflowEventArgs) WorkflowEventArgs e.Work

13、flowInstance 工作流实例WorkflowLoaded引擎中的某个实例: 加载到内存时 Sub OnWorkflowLoaded(ByVal sender As Object, ByVal e As WorkflowEventArgs) WorkflowEventArgs e.WorkflowInstance 工作流实例WorkflowPersisted引擎中的某个实例: 进入持久化状态后,注,如果没有加载持久化服务,而调用持久化方法,该事件仍会触发,但实例并没有被持久化 Sub OnWorkflowPersisted(ByVal sender As Object, ByVal e

14、As WorkflowEventArgs) WorkflowEventArgs e.WorkflowInstance 工作流实例WorkflowResumed引擎中的某个实例:从挂起状态恢复后 Sub OnWorkflowResumed(ByVal sender As Object, ByVal e As WorkflowEventArgs) WorkflowEventArgs e.WorkflowInstance 工作流实例WorkflowStarted引擎中的某个实例:被启动后 Sub OnWorkflowStarted(ByVal sender As Object, ByVal e As

15、 WorkflowEventArgs) WorkflowEventArgs e.WorkflowInstance 工作流实例WorkflowSuspended引擎中的某个实例:被暂停后,如Suspend控件会触发该事件 Sub OnWorkflowSuspended(ByVal sender As Object, ByVal e As WorkflowSuspendedEventArgs) WorkflowEventArgs e.WorkflowInstance 工作流实例 e.Error 暂停信息WorkflowTerminated引擎中的某个实例:终止后,如工作流内部的异常会引起终止 Su

16、b OnWorkflowTerminated(ByVal sender As Object, ByVal e As WorkflowTerminatedEventArgs) WorkflowTerminatedEventArgs e.Exception 异常 e.WorkflowInstance 工作流实例WorkflowUnloaded引擎中的某个实例:从内存中移出后 Sub OnWorkflowUnloaded(ByVal sender As Object, ByVal e As WorkflowEventArgs) WorkflowEventArgs e.WorkflowInstance

17、 工作流实例事件代码快速粘贴 AddHandler 引擎.ServicesExceptionNotHandled, AddressOf OnServicesExceptionNotHandled AddHandler 引擎.Started, AddressOf OnStarted AddHandler 引擎.Stopped, AddressOf OnStopped AddHandler 引擎.WorkflowAborted, AddressOf OnWorkflowAborted AddHandler 引擎.WorkflowCompleted, AddressOf OnWorkflowComp

18、leted AddHandler 引擎.WorkflowCreated, AddressOf OnWorkflowCreated AddHandler 引擎.WorkflowIdled, AddressOf OnWorkflowIdled AddHandler 引擎.WorkflowLoaded, AddressOf OnWorkflowLoaded AddHandler 引擎.WorkflowPersisted, AddressOf OnWorkflowPersisted AddHandler 引擎.WorkflowResumed, AddressOf OnWorkflowResumed A

19、ddHandler 引擎.WorkflowStarted, AddressOf OnWorkflowStarted AddHandler 引擎.WorkflowSuspended, AddressOf OnWorkflowSuspended AddHandler 引擎.WorkflowTerminated, AddressOf OnWorkflowTerminated AddHandler 引擎.WorkflowUnloaded, AddressOf OnWorkflowUnloaded#Region 引擎事件 加载服务 Sub OnServicesExceptionNotHandled(By

20、Val sender As Object, ByVal e As System.Workflow.Runtime.ServicesExceptionNotHandledEventArgs) ServicesExceptionNotHandledEventArgs e.Exception异常信息 e.WorkflowInstanceId 工作流实例的GUID Console.WriteLine() Console.WriteLine(-OnServicesExceptionNotHandled-) Console.WriteLine(有实例完成: + e.WorkflowInstanceId.T

21、oString) Console.WriteLine(异常信息 + e.Exception.Message) Console.WriteLine(-) Console.WriteLine() End Sub 引擎启动后 Sub OnStarted(ByVal sender As Object, ByVal e As WorkflowRuntimeEventArgs) WorkflowRuntimeEventArgs e.IsStarted 是否启动 Console.WriteLine() Console.WriteLine(-OnStarted-) Console.WriteLine(引擎启动

22、状态: + e.IsStarted.ToString) Console.WriteLine(-) Console.WriteLine() End Sub 引擎停止后 Sub OnStopped(ByVal sender As Object, ByVal e As WorkflowRuntimeEventArgs) WorkflowRuntimeEventArgs e.IsStarted 是否启动 Console.WriteLine() Console.WriteLine(-OnStopped-) Console.WriteLine(引擎启动状态: + e.IsStarted.ToString)

23、 Console.WriteLine(-) Console.WriteLine() End Sub 被中断后 Sub OnWorkflowAborted(ByVal sender As Object, ByVal e As WorkflowEventArgs) WorkflowEventArgs e.WorkflowInstance 工作流实例 Console.WriteLine() Console.WriteLine(-OnWorkflowAborted-) Console.WriteLine(被中断的实例: + e.WorkflowInstance.InstanceId.ToString)

24、 Console.WriteLine(-) Console.WriteLine() End Sub 当有实例完成时 Sub OnWorkflowCompleted(ByVal sender As Object, ByVal e As WorkflowCompletedEventArgs) WorkflowCompletedEventArgs e.OutputParameters用参数方式与实例的属性进行通信 e.WorkflowInstance 工作流实例 e.WorkflowInstance 引发该事件的实例 Console.WriteLine() Console.WriteLine(-On

25、WorkflowCompleted-) Console.WriteLine(有实例完成: + e.WorkflowInstance.InstanceId.ToString() Console.WriteLine(sender: + sender.ToString) Console.WriteLine(-) Console.WriteLine() End Sub 当有实例被创建后 Sub OnWorkflowCreated(ByVal sender As Object, ByVal e As WorkflowEventArgs) WorkflowEventArgs e.WorkflowInsta

26、nce 工作流实例 Console.WriteLine() Console.WriteLine(-OnWorkflowCreated-) Console.WriteLine(有实例被创建: + e.WorkflowInstance.InstanceId.ToString() Console.WriteLine(-) Console.WriteLine() TextBox1.Text = e.WorkflowInstance.InstanceId.ToString End Sub 当有实例进入空闭状态 Sub OnWorkflowIdled(ByVal sender As Object, ByV

27、al e As WorkflowEventArgs) WorkflowEventArgs e.WorkflowInstance 工作流实例 Console.WriteLine() Console.WriteLine(-OnWorkflowIdled-) Console.WriteLine(有实例进入空闭状态: + e.WorkflowInstance.InstanceId.ToString() Console.WriteLine(-) Console.WriteLine() End Sub 当有实例加载到内存时 Sub OnWorkflowLoaded(ByVal sender As Obje

28、ct, ByVal e As WorkflowEventArgs) WorkflowEventArgs e.WorkflowInstance 工作流实例 Console.WriteLine() Console.WriteLine(-OnWorkflowLoaded-) Console.WriteLine(有实例加载到内存时: + e.WorkflowInstance.InstanceId.ToString() Console.WriteLine(-) Console.WriteLine() End Sub 当有实例进入持久化状态后 Sub OnWorkflowPersisted(ByVal sender As Object, ByVal e As WorkflowEventArgs) WorkflowEventArgs e.WorkflowInstance 工作流实例 Console.WriteLine() Console.WriteLine(-OnWorkflowPersisted-) Console.WriteLine(有实例进入持久化状态: + e.

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1