Rehosting the WF4 designer - how to save and execute workflows created through the rehosted designer

StackOverflow https://stackoverflow.com/questions/2098450

Question

I'm looking for some clarity with regards to the use of Windows Workflow 4 in an integrated solution - specifically with regards to rehosting the designer and executing workflows created by eg. a business user.

Is the intention that the required custom activities are created and compiled into a dll, which is then deployed with the rehosted designer, allowing the business user to create/configure workflows that make use of these activities - the business user would then save the workflow as XAML, which can be stored in a location known to the application (database, filesystem etc.), and then when it is necessary for the application to execute a workflow, it can use XamlServices.Load to load the workflow from the specific location and execute it as a DynamicActivity?

How is the workflow saved so that it can later be reserialized with properties and other configuration values? I've tried deserializing a Xaml file saved out of the designer, and also using XamlServices.save().

Are there any potential issues here with using bookmarks/persistence?

As a related question, is there any easy way to "Go back" in a workflow, without defining return branches on every flowchart element? I'm looking at integrating a workflow with a UI for a user to enter responses, which the wf will process, and make decisions based on the input. Through the UI, the user should be able to "Go Back" to a previous input.

Was it helpful?

Solution

You can use the ActivityXamlServices.Load(path) to load a XAML file. It will return an Activity, actually a DynamicActivity, and you can use a WorkflowApplication to run it.

See my blog post for an exmple.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top