How to use custom ActivityCondition or filter which ActivityConditions are available

If you have your own custom ActivityCondition you are only going to be able to use it with your custom activities, not out of the box activities like While or IfElseBranch.  First start by creating your custom ActivityCondition like the following:   [DisplayName(“Custom Activity Condition”)] public class CustomActivityCondition : ActivityCondition {     public override bool…


Switch activity

The Switch activity I created is based on the switch statement in C# or the Select Case statements in VB.  You have an expression and one or more case statements, one of which can be the default.  To model within workflow the case becomes a property that must be on the children of the Switch…


Basics of Working with Custom Types in Workflow

If you have used a custom type for an activity / workflow property you have probably ran into a few issues.  You might have had problems trying to get it serialized correctly or to be able to set the value in the property browser.  With this post I will try and shed some light on…


Do you want to invoke another workflow but you won’t know which one until runtime?

The InvokeWorkflowActivity that ships with WF requires you to set the type of the target workflow at design time.  If you won’t know which workflow to invoke until runtime you need to write a custom activity. To invoke a workflow need to use the IStartWorkflow service that you can get from the ActivityExecutionContext, like the…


Do you need to launch another process from your workflow?

When start another process from your workflow you can’t just not return from the Execute method until the process completes.  This would block the entire workflow from receiving any other events and would hold onto the thread.  Instead you need to use a queue to get notification when the process completes. ProcessActivity.EXE


How to set activity property from a custom input form

Sometime you might want to create an input form for your user to set properties on your custom activity.  Unfortunately when you set the properties directly on the activity from the input form the values don’t always get reflected on your activity.  To resolve this you need to set the value on the PropertyDescriptor for…


How to send data to a workflow

Sometimes you need to send data to a workflow from the host.  To do this you need create an interface that is decorated with the ExternalDataExchange attribute and contains an event delegate like the following:   [ExternalDataExchange] public interface IMyService {     event EventHandler<CompletedEventArgs> Completed; }   In your workflow add a HandleExternalEventActivity and set…


Project template for XAML Activation Console Application

If you work with XAML activation from time to time and like being able to debug your workflow using a console application you should install these templates.  However, you don’t like having to modify the default console application template each time.  I created sequential and state machine console application project templates for both Visual Basic…


Examples of using Persistence and Tracking in ASP.NET

When you are working with ASP.NET you may have the need to persistence and / or tracking.  I have put together two examples, one with shared databases and the other with separate, and included the command scripts to create the databases for you.  There are VB and C# versions of each sample.   When you…


Using XAML activation in ASP.NET with a StateMachineWorkflow

If you want to use XAML activation in ASP.NET you will need to be using Windows Workflow Foundation Beta 2.2, that can be found here.  The reason for this is that although XAML activation works in most cases with Beta 2 it isn’t officially supported in that build because it was added as a feature…