To create a basic custom activity, you inherit from the Activity class or a derived type. To create a custom composite activity, you inherit from the CompositeActivity class or a derived type.
Note: |
|---|
|
Creating a custom activity that inherits from a custom activity that contains child activities is not supported. |
The custom activity class you create defines the properties, events, and execution logic for the custom activity.
Properties
You may use two types of activity properties in your custom activity: meta properties and instance properties. A meta property is immutable at run time, so the property must be set to a literal value at design time. An instance property can be set at design time or the property can be bound to instance data, in which case the actual value is not determined until run time. Instance properties can also be modified directly during workflow execution.
For more information about activity properties, see Using Activity Properties.
Execution Logic
When you create a custom activity, you must explicitly handle the execution logic of your activity through the Execute method. Additional Activity methods may be overridden as required in your activity.
Attributes
Your custom activity can be decorated with various attributes to indicate such things as which activity designer should be loaded, what validator should be used when validating your activity, and so on. The following table lists all the attributes that you can use to decorate your custom activity.
Caution: |
|---|
|
If your custom activity uses the PersistOnCloseAttribute, the workflow that uses your custom activity must specify a persistence service to use or an exception is thrown when the workflow is started. |
Attributes can be "overridden" in the sense that if you decorate your custom activity with attributes used by your base activity, your overridden values are used against your custom activity. For example, you may want to create your own toolbox bitmap for your custom activity, but still use the default serializer and activity validator of your base activity. To do this, you would only have to decorate your custom activity with the ToolboxItemAttribute and set the value accordingly.
Creating Custom Activities from Default Windows Workflow Foundation Activities
You can derive your custom activity from the following activity types:
Customizing Activities
See Also
Copyright © 2007 by Microsoft Corporation. All rights reserved.