Workflow development for informatization infrastructure

Source: Internet
Author: User

Workflow development

1. Custom workflows and activities

2. runtime Service

 

Custom workflows and activities

First look at the workflow designer Interface

You can see from the interface that the following work needs to be done:

1. the Save command under file to save the workflow definition to the database, which exists in XML format. Save the workflow definition as a xoml file, to provide a flow designed by the sender and send it directly to the customer's computer. Another benefit of saving the xoml file is to facilitate debugging and diagnosis to identify problems.

2. Design host, rehosting designer. Check msnd to implement

3. Custom activities. Net 3.0/3.5 built-in activities involve a lot of programming content. Because custom workflows are certainly not used for secondary development, but are designed and implemented for common users, all built-in activities of. NET are useless. Even simple if else activities must be implemented independently.

Create an ordered workflow, drag sendmessageactivity to the designer, and double-click the activity. The window is displayed.

This is a message writing form, which is very similar to the form in which outlook sends emails. If the message is sent directly, it is not easy to track and search for historical records. Therefore, the message is customized and an option is provided, allowing the user to decide whether to send the message as an email at the same time.

Let's take a look at the activity.

This activity runs different branches based on different values, which is similar to the IF else statement. The key here is the design, evaluation (evaluate) of the condition, and passing values in the operation.

Recall the statement of conditions in the SQL statement. Select employee_name from employee where employee_no = '007'

One way is to use the UI interface to convert the conditions entered by the user into the where part of the SQL statement, so that the database can help evaluate and determine the value.

To use this method, we should try our best to make it easy for users to enter conditions in an intuitive and easy way, and parse themselves into SQL conditions.

Another method is codedom, which is also the built-in rule generation method of workflow. Here, why didn't the rule editor and rule format of workflow be used directly? I understand it in this way. The built-in rule of workflow is suitable for programming, such as the condition amount> 13 (the amount is greater than 13 ), this condition requires that the workflow that uses this activity have the variable amount. Otherwise, this condition is invalid and will cause errors during verification, which is unacceptable.

In a custom workflow, a variable (generally a class) is transferred to the currently running workflow. The value and attribute of the type variable are as follows, it is most of the content we need in custom conditions. Additional condition attributes also include some environment variables.

For example, we assume that, if the total amount of a purchase order is less than 10000, it is approved. If it is greater than 10000, it is rejected.

 

The approval and reject activities are easily written. You can directly update the approval or reject field status.

The difficulty of the problem lies in the judgment of conditions. View the condition judgment form, for example.

The totitemamt field is equivalent to the previous amount, which refers to the total amount of materials. The final purchase amount also includes taxes and transportation fees.

During running, convert the condition into a codedom statement and evaluate the value.

Because we need to put it in workflow, rewrite an activitycondition and rewrite its method.
Public class customactivitycondition: activitycondition

{

Public override bool evaluate (activity, iserviceprovider provider)

{}

}

You can see that there are two insert remove commands, which can add or delete new conditions. Obviously, this is a set of conditions.

Private list <epnifelsecondition> _ conditions;

 

Runtime Service

1. SQL database is provided for persistent workflow. Add sqlworkflowpersistenceservice.

2. for ASP. NET applications, you must provide mannualworkflowsecheduleservice.

3. Expose the workflowruntime of WF to the WCF Service to support workflow applications across AppDomains.

4. form binding

As mentioned in the interface section of the form, the form already provides the standard interface save and post. In the form framework, you can determine the current form and the current operation command (save, update, new, post) whether a workflow is bound. If yes, start the workflow.

5. workflow tracking, refer toProgram.

6. For dynamic changes, refer to the program in msdn.

workflow defines a set of workflow development methods and rules. We need to override it to implement custom applications, instead of directly using them.

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.