WF (III)

Source: Internet
Author: User

Objective:

By now we can see that WF4 contains a designer for a. xmal file and a runtime that invokes the activity. When you create your own workflow, you are also creating an activity,

Because the activity is a class that inherits System.Activities.Activity.

Activities can implement business processes, and some activities implement business processes by invoking other activities, such as sayhello activities that do not write text to the console, but rather through WriteLine activities.

To achieve this we will inherit a different base class System.Activities.CodeActivity.

Demo production:

1. Apply WF (ii) solution.

2. Create Sayhellocode activity, and write text to console via Console.WriteLine

Right-click the Helloworkflow project, select Add New Project, select Code Activity named Sayhelloincode;

In the Sayhelloincode class, delete the Text property and related, leaving only an empty execute empty method;

CodeActivity is an abstract class, so it is necessary to implement the Execute method when inheriting codeactivity, and execute this method to carry out your activity work;

Here we should rewrite execute such as:

3 update Proram.cs to call Sayhelloincode

:

4 recompile execution will succeed and display such as:

Then Demo3 is done.

Why do I need to create a code activity?

By writing business logic in code so that your business logic can be combined into larger business programs while using workflow runtime, this will benefit your threading model, data processing, and other aspects of the program's

Scalability has been greatly improved. (and the demo will talk about it).

WF (III)

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.