Persistent learning WF (3): WF framework Overview

Source: Internet
Author: User

[Stick to the top] Keep learning WfArticleIndex

I think there is nothing to write about this article. I think it's a big hat. If I say it's too simple, there's nothing to do with it. I can't finish writing it, and I just can't go deep into it (:-)). WF is a scalable framework and is designed for scalability at every level from bottom to top. WF provides a workflow engine, A. Net hosted API, A Runtime Library Service, and a visual designer and debugger integrated with Microsoft Visual Studio 2008. You can use Windows Workflow Foundation to generate and execute workflows that span both the client and server, as well as all types of. NET applications.ProgramInternal workflow. I found a cool WF framework on the Internet (from infoq ):

The following is a brief introduction of each part:

WF class libraries and framework:

Is the Basic Class Library of WF.

 

Workflow engine:

Indicates the configurable execution environment provided by the workflow engine during Workflow running, which is completed by the workflowruntime class in WF. Each appdomain can only create one workflowruntime instance, because by default, an application only has one appdomain. If your application creates another appdomain, you can create a workflowruntime instance. In the host, workflowruntime runs independently. It can load multiple workflow instances, and each workflow instance has an independent thread in workflowruntime.

 

Runtime service:

WF provides two types of services: Core Service and Local Service. core service is provided by Microsoft, such as persistence service and tracking service, core Service implements communication between jobs and the Host Program. Therefore, it is also called the data exchange service. There are many things about how to register and use core service and local service.

 

Host environment:

A workflow is an assembly (DLL). It must have a host environment. Its host environment can be any application, such as the console, Windows form, and ASP.. net, the following illustration shows how to simultaneously carry workflows, activities, and workflow runtime engines (derived from msdn) in a host application process ).

 

Workflows and activities:

A workflow is a group of elements stored as a model named activity. An activity is used to describe the actual process. A workflow provides a method to describe the execution sequence and dependency between multiple short-term or long-term jobs. The model runs from start to end, and activities can be manually executed or executed by system functions. In WF, the workflow instance is represented by workflowinstance.

 

Below is the persistence in learning WF (1): Starting from helloworld, In the helloworld ProgramCodeTo host the workflow in the console program.

Using (Workflowruntime =   New Workflowruntime ())
{
Autoresetevent waithandle =   New Autoresetevent ( False );
Workflowruntime. workflowcompleted + =   Delegate ( Object Sender, workflowcompletedeventargs E)
{Waithandle. Set ();};
Workflowruntime. workflowterminated + =   Delegate ( Object Sender, workflowterminatedeventargs E)
{
Console. writeline (E. Exception. Message );
Waithandle. Set ();
};
Workflowinstance instance = Workflowruntime. createworkflow ( Typeof (Helloworld. workflow1 ));
Instance. Start ();
Waithandle. waitone ();
Console. writeline ( " Press any key to exit " );
Console. Readline ();
}

The following describes the common workflowruntime and workflowinstance methods:

Workflowruntime

Startruntime () method: Start the engine.

Stopruntime () method: stop the engine.

Createworkflow () method: Create a workflow instance.

It has some events related to the engine status, such as workflowcompleted and workflowterminated in the code above.

Workflowinstance has some running control methods, such as start, abort, resume, and terminate, which can be found on msdn and it makes no sense to list them, it has an instanceid attribute to get the guid of the current instance, and the workflow instance uses guid as the unified identifier.

 

Finally, the scheme of wxwinter (Winter.

Previous Article: persistence in learning WF (2): WF creation mode and design-time tools
Next article: Keep learning WF (4): Activity and dependencyproperty)

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.