Skip Ribbon Commands
Skip to main content
Using Windows WorkFlow Foundation
 
 
 

WWF How-To's

Custom Activities

Extensions

"Extensions" are regular classes with public methods and properties used to add functionality to an entire workflow application.  A workflow application can have only one instance of an extension class. 

Extension objects are added to the workflow application using WorkflowApplication.Extensions.Add().  An activity's Execute method can access the extension object by using it's context.GetExtension<TypeOfExtension>() method.

A workflow can add its own extensions in its CacheMetadata method by using the AddDefaultExtensionProvider<T> method of the "metadata" (ActivityMetadata, CodeActivityMetadata, NativeActivityMetadata) input parameter, for example:

protected override void CacheMetadata(NativeActivityMetadata metadata)
{
    base.CacheMetadata(metadata);
    metadata.AddDefaultExtensionProvider(() => new MyExtension());
}

 

 

WWF Data Model - includes info on Variables, Arguments and Expressions

WWF and WCF

 

Rehosting the WWF Designer

 

WWF and AppFabric

 

Launching a Workflow

  • http://msdn.microsoft.com/en-us/library/dd560894.aspx
    • Basically, there are two ways to run a workflow: use workflowinvoker.invoke or create a new workflowapplication. creating a new workflowapplication is more useful and allows us to access a wider range of features, including handling exceptions which occur in the workflow and bookmarks
    • Also, there is running a workflow as a service as would be in AppFabric on a server.   Note that the workflow must be set up beforehand to be run as  a workflow service.

 

Triggered Workflows -- launching a workflow due to external conditions/events

Bookmarks

Traversing the Activity Tree that makes up your workflow

http://msdn.microsoft.com/en-us/library/ee358719.aspx

Routing in WCF

Manually Converting Workflow to and from XAML

WorkflowMarkupSerializer serializer =
  new WorkflowMarkupSerializer();

using (XmlWriter writer = new XmlTextWriter(
  new StreamWriter("test.xaml")))
{
  serializer.Serialize(writer, seq);
}
  • This code will serialize a workflow into the file test.xaml by calling your activity's serializer rather than using the WF default

Writing a free form custom activity

http://blogs.msdn.com/b/tilovell/archive/2009/12/31/freeform-custom-activity-designers-using-icompositeview.aspx

 

AppFabric Management

Tracking and Logging

 

Workflows in the Cloud

Tips and Traps