在工作流应用程序/SIngelton 工作流之间共享变量
我正在运行 ac# 应用程序,该应用程序出于某些目的启动工作流活动(使用 invokeworkflowapplication)。我希望能够在我从应用程序启动的所有流之间共享一个静态类(某种它们都可以随时访问的单例类)。
有没有这样的方法可以使我启动的流程在某个单例上下文中运行?
谢谢!
i am running a c# application that is launching workflow activities for some purposes (using invokeworkflowapplication). I would like to be able to share a static class between all flows i am launching from my application (some sort of singelton class that they can all acccess at any time).
Is there such a method to make the flow i am launching run in some singelton context??
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在不同工作流和实例之间共享数据的一个好方法是创建工作流实例扩展。此扩展必须由您的应用程序添加,并且其相同的实例可用于您的所有 WorkflowApplications、调用程序或服务,因此它将是“单例”。
示例:
然后,在活动内部,您可以调用
如果您需要工作流程级别的数据(而不是代码),您可以创建一个自定义活动来将数据检索到变量。
如果它不符合您的需求,请查看 enterprise 的此实现变量
A nice way to share data between different workflows and instances is to make a workflowInstanceExtension. This extension must be added by your application and its same instance be used to all your WorkflowApplications, invoker or service, so it will be a "singleton".
Example:
Then, inside an activity, you can call
If you need the data at workflow level(not code), you could make a custom activity to retrieve the data to a variable.
If it don't fit your needs, take a look at this implementation of enterprise variables
您可以在工作流程中使用任何您想要的 VB 表达式,这样您就可以只访问单例对象。您还可以使用 Extensions 集合将相同的对象添加到每个 WorkflowApplication。在这种情况下,您可以使用检索自定义活动内部的对象,但不能使用 VB 表达式。
You can use any VB expression you want inside your workflows so you can just access a singleton object. You can also add the same object to each WorkflowApplication using the Extensions collection. In that case you can use retrieve the object inside of custom activities but not using VB expressions.