简体   繁体   English

使用 XAML + X:name 动态创建 WWF 工作流不起作用

[英]Creating WWF workflow dynamically using XAML + X:name is not working

I am creating a custom workflow activities, these activities have a base class as shown below我正在创建一个自定义工作流活动,这些活动有一个基础 class 如下所示

public class BaseClass : SequenceActivity
{ }

public class Activity1 : BaseClass
{ }

public class Activity2 : BaseClass
{ }

Then I write the xoml of the workflow as shown below然后我编写工作流的xoml如下图

<GS1:Activity1 x:Name="Activity2"></GS1:Activity1>
<GS1:Activity2 x:Name="Activity3"></GS1:Activity2>

everything works fine until i want to start the workflow一切正常,直到我想开始工作流程

workflowRuntime.CreateWorkflow(Type.GetType("WorkflowType Full Name"), null, Guid.NewGuid());

I get the below error我收到以下错误

error 1538: Activity 'BaseClass' validation failed: There is already an activity named 'BaseClass'. Activity names must be unique.

Note that the above was working correctly on WF3.5, this error appeared when I upgraded to WF4.0.请注意,上述在 WF3.5 上正常工作,当我升级到 WF4.0 时出现此错误。

Any help is very appreciated.非常感谢任何帮助。

It looks like you are combining WF3 and WF4 classes here.看起来您在这里组合了 WF3 和 WF4 类。 It is a bit confusing because they are similar and both have an Activity class but there is no relation.这有点令人困惑,因为它们相似并且都具有活动 class 但没有关系。 The WorkflowRuntime is a WF3 type. WorkflowRuntime 是 WF3 类型。 With WF4 you can use the WorkflowApplication or the WorkflowInvoker to run a workflow.使用 WF4,您可以使用 WorkflowApplication 或 WorkflowInvoker 来运行工作流。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM