.netwpfworkflow-foundation-4rehosting

What is the difference between using WorkflowInvoker and WorkflowApplication?


and I notice when I use Invoker and call invoker.Invoke() directly the GUI won't refresh while running. What other difference are there?


Solution

  • Running a workflow using the WorklfowInvoker is an synchronous call. So it will block as long as your workflow is running. It is intended for short running worklfows and unit testing of activities and doesn't support the Workflow Instance Store.

    The WorklfowApplication is asynchronous and executes workflows as an asynchronous task, so the Run only schedules execution and returns. ON what thread it executes depends on the SynchronizationContext used, the default is using the ThreadPool. Status updates, like the workflow completing are done through callbacks you set. It also supports the Workflow Instance Store.