Reputation: 1350
I used to have a workflow service, using a xamlx file.
Now what I want to do is to create multiple workflows, and depending on the nature of the operation I want to be able to invoke WF1 or WF2.
So, I want to be able to dynamically load the xamlx and then pass it all it needs (say, a string) and then call it's initial method, say Start().
Any ideas on how to do that? I found some code that does that:
string workflow = new StreamReader(Assembly.GetExecutingAssembly().GetFile("WF1.xamlx")).ReadToEnd();
var dynamicActivity = ActivityXamlServices.Load(workflow) as DynamicActivity;
WorkflowInvoker.Invoke(dynamicActivity);
though I'm not sure how it's going to behave.
Upvotes: 0
Views: 1096
Reputation: 1125
First to lines are OK. But you cannot use WorkflowInvoker to invoke Workflow Service.
WorkflowServiceHost Class is intended for hosting Workflow Services, and WorkflowInvoker Class is for "regular" workflows.
Upvotes: 0