Exploring Workflow Foundation Part 5: Custom activity validators

For completeness I can not pass the activity validation, so this is what this post will be about. However, as in the first part of this series I will make it rather easy on myself and provide some links to other posts which describe the things involved quite well.

Adding validation to your activity

The basic things involved in adding validation to your custom activities is again descibed in Keyvan Nayyeri excellent series: How to Write a Validator for Custom Workflow Activity. Morgan Skinner goes a little further in his post Activity Validation describing how to connect a validation error of a property to the property, and to the property window in the designer.

Your options for validation

To validate activities you actually have two possibilities:

  1. Use a custom validator
  2. Use the ValidationOptionAttribute attribute

The first option is described in the blog posts mentioned above. How and when to use the attribute is described on The Problem Solver blog in the post Validating workflow activity metadata

Use case: validating the type of your parent activity

In the provided sample code you can find an example on how to validate that the parent activity of an activity is of a certain type. Hope you enjoy it.


The Code


How to Write a Validator for Custom Workflow Activity
Activity Validation
Validating custom activities in the Workflow designer
Validating workflow activity metadata


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s