0

I’m working with a .NET Workflow Foundation (CoreWF) based engine that runs workflows with multiple steps (custom NativeActivity implementations). Each step executes synchronously and immediately schedules the next one, e.g.:

protected override void Execute(NativeActivityContext context)  {
    RunSql("SELECT * FROM Table1");
    WaitForOneMinute();
    context.ScheduleActivity(this.NextStep);
}

So a workflow might look like: SQLStep1 → SQLStep2 → SQLStep3 Each step executes right after the previous one finishes so there are no bookmarks or idle points between them. I need to pause or suspend the workflow in the middle of execution (e.g. during Step 2), possibly because an external user pressed a “Pause” button in the UI. Is it possible to do this from outside the thread that launched the WorkflowApplication ? Probably a new one because it will be triggered from a separate button click.

I thought about maintaining an in-memory dictionary like:

static readonly ConcurrentDictionary<Guid, WorkflowApplication> ActiveInstances = new();

so that when I start a workflow, I can keep a reference and later retrieve it to call Unload(). This works fine while the process is running. However, after an iisreset (or application restart), the dictionary is cleared, meaning I lose all references to the running WorkflowApplication objects.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.