I have a very big workflow, it's using the framework 4. Some workflow can stay in the system for up to 2 years, and whenever I update the workflow, all the existing instances will no longer work..
I have seen some workarounds using the 'Routing' method, where you have 2 different versions of WF in the system, and it will route to the correct WF when it executes. However I couldn't really use this method because I need all the existing instances to use the updated new version of the workflow.
Therefore, I have found the dynamic update way to work around it, but I couldn't get it to work. Does anyone have any tutorials somewhere? I have seen some examples, but they seems to be .NET framework 2 or 3.
Currently, I have created a new Activity Class called: TestClass.cs And here is the code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Activities;
using SPABLL;
using System.Workflow.ComponentModel;
namespace SPAWorkflow.Activities.DynamicUpdate
{
public sealed class TestClass : NativeActivity
{
protected override void Execute(NativeActivityContext context)
{
WorkflowChanges wc = new WorkflowChanges(this);
}
}
}
But the line: new WorkflowChanges(this); is giving me a error because 'this' is not a System.Workflow.ComponentModel.Activity Object, and I'm not sure what to pass in..
Not sure if anyone can shed me some light or you have some working samples I can follow.
Thanks very much!!!
This doesn't work. The WorkflowChanges type and the System.Workflow.ComponentModel.Activity it requires are part of WF3 and not WF4.
With WF4 you will have to wait for .NET 4.5 to get similar capabilities.