Workflow extension step 1-use [previous]-wf4.0 for activities in a set group

Source: Internet
Author: User
Opening

In the previous article, we mainly talked about WorkFlow Design step.6-invokemethod call object or type method-wf4.0 and how to use invokemethod to design and develop a workflow.

The extended content mainly describes how to use collection in a workflow.

Summary

In this article, we are the first extension article. This article mainly describes the usage of collection. Generally, we operate collections in the following ways: add, delete, and query, therefore, WF provides the following four types by default.

Collection activities:

Specifically, I think we can literally tell you a story. Let's take a look at the specific usage details.

Finally, let's sort out a process and integrate all the activities of these four sets into a process.

Outline

1. Opening

2. Summary

3. Outline

4. collection activity usage

Set usage 1. addtocollection <t> Activity

1. Create a console project:

2. Add the corresponding node to the designer:

3. Drag an addtocollection activity in the sequence control flow, select the activity, and view related properties. Press F4 as follows:

4. We define a variable in sequence, which is of the set type, such as ilist. We set the attributes of addtocollection activity:

A. add variables:

And the mycollection must be initialized; otherwise, an error is returned:

B. Set the attributes of the addtocollection activity as follows:

5. Add a foreach <t> activity. Content in the loop output set:

6. Run F5 and check the result to see if the result is consistent with our expectation:

The addtocollection <t> activity is described above, and the usage of other activities is similar.

Next let's take a look at the usage of clearcollection <t>. The main function of this activity is to clear the items in the set.

2. clearcollection <t> Activity

The specific function of clear is to clear all the items in the specific target set. The specific usage is as follows:

1. Create an activity file, drag a sequence and addtocollection, and add a clearcollection activity:

2. Set clearcollection activity attributes as follows:

3. Next, we will add several writeline activities to identify the start and end of the WF process, and record the specific content of each operation as follows:

The above content is a bit large, so I split it, but the above images are complete together. If you cannot understand it, please referCodeRight:

4. Run F5 and check the specific running result to see if we want it. After the clearcollection activity is executed, will the set output the result?

5. For a clearer demonstration, we will add a few more addtocollection <t> activities above and add some items to the set:

6. Continue F5 and check the running effect:

7. We should have discovered that the addtocollection above is not very convenient. In actual scenarios, we may use the while loop to add nodes?

Or another loop method. Next we add elements to the set through a loop.

A. Define the myflag variable, int32 type, and sequence. You can control the number of loops.

B. Delete the original addtocollection activity. Add the while activity as follows:

C. Run F5 and check the output to see if it is the same as we thought:

Source code download

More communication

Official blog: http://www.smarteas.net/

Http://www.agilelab.cn/

If you have any questions about using the agileeas. NET development platform, use the following contact methods or communication methods.

1. Telephone-Email:

He gozhou: hegezhou_hot@163.com mobile phone: 18691480181 blog: http://www.cnblogs.com/hegezhou_hot/

2. QQ communication:

308961614-Network Name: h.o. t

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.