Windows 工作流中的 WorkflowServiceHost - .NET 4 版本

发布于 2024-08-18 15:11:41 字数 501 浏览 4 评论 0原文

我无法找到有关 .NET 4 / VS 2010 Beta 2 附带的新版本 WorkflowServiceHost 的任何有价值的文档。

新版本的 WorkflowServiceHost 现在位于 System.ServiceModel.Activities 中,并且具有与旧版本不同的构造函数。 NET 3.x 版本,位于 System.ServiceModel 中。

我希望能够通过传入 .NET 3.x 版本中允许的先前构造函数之类的类型来加载我的工作流程...

public WorkflowServiceHost(Type workflowType, params Uri[] baseAddress)

我的问题是我没有任何其他构造函数在编译时所需的信息(我计划通过 Type.GetType(string) 推断工作流的类型,因为我只能在运行时访问实际的工作流活动)。

有没有其他方法可以托管在运行时加载的工作流程?

提前感谢您的所有帮助:)

I'm having trouble finding any worthwhile documentation on the new version of WorkflowServiceHost that ships with .NET 4 / VS 2010 Beta 2.

The new version of the WorkflowServiceHost now lives in System.ServiceModel.Activities and has different contructors than the old, .NET 3.x version that lived in System.ServiceModel.

I want to be able to load my workflow by passing in the type like this previous constructor in the .NET 3.x version allowed...

public WorkflowServiceHost(Type workflowType, params Uri[] baseAddress)

My issue is that I don't have the information any of the other contructors need at compile time (I was planning to infer the Type of my workflow via Type.GetType(string) as I will only have access to the actual Workflow activities at runtime).

Is there any other way that I can host a workflow that has been loaded at runtime?

Thanks for all your help in advance :)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

花开浅夏 2024-08-25 15:11:41

在 WF4 中,您将实际的工作流定义作为活动树而不是像以前那样传递类型。如果您有类型,那么使用 Activator.CreateInstance() 之类的方法创建对象应该很简单。使用活动树而不是类型有一些好处,因为您可以使用 ActivityXamlServices.Load() 读取 XAML 文件来动态创建对象。

如果您愿意,WorkflowServiceHost 的 WCF 部分可以完全在配置文件中完成。无需在构造函数中传递基地址。

WorkflowServiceHost 的替代方案是使用 WorkflowApplication。但这仍然需要您将活动树添加到构造函数中。

In WF4 you pass the actual workflow definition as an activity tree instead of a type as you did before. If you have the type creating an object should be simple using something like Activator.CreateInstance(). Using an activity tree instead of a type has some benefits because you can create the objects on the fly of use the ActivityXamlServices.Load() to read a XAML file.

The WCF part of the WorkflowServiceHost can be done completely in the config file if you like. No need to pass a baseAddress in with the constructor.

An alternative to the WorkflowServiceHost is using a WorkflowApplication. This still requires you to add an activity tree into the constructor though.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文