WF already provides many types of activities that can meet the basic needs of most people, however, in actual projects, you sometimes need to re-develop or encapsulate some activities with special business significance for use in the workflow. Therefore, WF provides the ability to expand the original activities and customize new activities, 1. You can create and develop custom activities through "workflow activity library.
Figure 1 create a custom Activity Project
1.1 Type of custom Activity
By default, the created custom activity inherits the "system. workflow. Activities. sequenceactivity" parent class. As shown in figure 2, the appearance of a custom activity is composed of a sequence ordered container. You can add other sub-activities to the sequence activity.
Figure 2 sequenceactivity-type custom Activity
If you want to create a special compensation-type custom activity, you can inherit the "system. workflow. componentmodel. compositeactivity" parent class. The appearance of this type of custom activity is shown in 3. You cannot add any sub-activity to this activity.
Figure 3 compositeactivity-type custom Activity
If you want to encapsulate some additional functions based on the callexternalmethod activity, you can inherit the "system. workflow. Activities. callexternalmethodactivity" parent class. This type of custom activity is shown in Figure 4.
Figure 4 callexternalmethodactivity-type custom Activity
If you want to encapsulate some additional functions based on the handleexternalevent activity, you can inherit the "system. workflow. Activities. handleexternaleventactivity" parent class. This type of custom activity looks 5.
Figure 5 handleexternaleventactivity-type custom Activity
You can inherit the "system. workflow. componentmodel. Activity" parent class to customize a "componentmodelactivity" type custom activity. Both sequenceactivity and sequenceactivity are the two most commonly used custom activities in daily work, it differs from the sequenceactivity type custom activity in that the user cannot add any sub-activity within it. The appearance of this type of custom activity is shown in 6.
Figure 6 componentmodelactivity-type custom Activity
Custom activities developed using WF are also very easy to use. As shown in 7, the custom activities developed in the same solution can be viewed and used in the toolbar after compilation is successful.
Figure 7 the toolbar displays the custom activities for development.