恢复一个持久窗口工作流程4活动在不知道具体的活动形式 [英] Resuming a persisted Window Workflow 4 Activity without knowing concrete type of activity
问题描述
我想知道如何能恢复(加载)previously坚持WF4活动不知道具体类型的活动。
I am trying to understand how one can resume (load) a previously persisted WF4 activity without knowing the concrete type of the activity.
为了加载一个持久的活动,我不仅需要其 workflowId
(我有),但我需要传递活动的一个实例过 - 所以我需要知道它的类型:
In order to load a persisted activity, I not only need its workflowId
(which I have), but I need to pass in an instance of the activity too - so I need to know it's type:
var workflowApplication = new WorkflowApplication(activity); // what type is activity?
workflowApplication.Load(workflowId);
的问题是,它可以是若干类型中的一种 - 该活动旨在被其他活动和工作流程内使用:它发送一个消息到消息队列,书签,然后持续存在。当通过消息队列接收到相应的消息就会恢复,但我不知道确切的具体类型原来的工作流程,而不检查持久性数据。这似乎是左右为难的。无需加载工作流程,检查其持续的数据不知道活动类型我无法加载工作流程,而且我不知道该活动类型。
The problem is that it could be one of a number of types - this activity is intended to be used within other activities and workflows: it sends a message to a message queue, bookmarks and then persists. It is resumed when a corresponding message is received via the message queue but I don't know the exact concrete type of the original workflow without examining the persistence data. This seems like catch-22. I can't load the workflow without knowing the activity type, and I can't know the activity type without loading the workflow and examining the its persisted data.
我觉得我失去了一些东西 - 有没有一种方法来创建一个托管WorkflowActivity不知道该活动,还是有办法来重新加载持久性数据制定的实际类型活动
创建前的 WorkflowActivity
?
I feel like I'm missing something here - is there a way to either create a hosting WorkflowActivity without knowing the activity, or a way to reload the persistence data to work out the actual type of activity
before creating the WorkflowActivity
?
推荐答案
有没有原生支持通过WF API来做到这一点,你要拿出自己的解决方案。
There's no native support to do it through WF API, you've to come up with your own solution.
最快的方法:存储扩展的使用InstancePromotedProperties表保存你自己的属性。
The fastest approach: Store Extensibility to use InstancePromotedProperties table to save your own properties.
可能是正确的做法:<一href="http://msdn.microsoft.com/en-us/library/system.activities.persistence.persistenceioparticipant.aspx"相对=nofollow> PersistenceIOParticipant 似乎这样做的正确方法。只要创建自己的表来存储任何你想要的,包括活动的类型。
Probably the correct approach: PersistenceIOParticipant seems the correct way of doing it. Just create your own table to store whatever you want including activity's type.
使用自定义活动,以节省为你的某个地方,之前一直存在。不是最好的,也不正确这样做了各种各样的原因的方法。
Use a custom activity to save it for you, somewhere, before persist. Not the best nor correct way of doing it for a variety of reasons.
这篇关于恢复一个持久窗口工作流程4活动在不知道具体的活动形式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!