From: http://developer.51cto.com/art/201001/181425.htm
Windows Workflow Foundation (WF) provides a programming model for In-process workflow engines that can be used as. NET applications.ProgramA long-running process of an internal workflow.
In. in net framework 4, compared with earlier versions 3.0 and 3.5, Windows Workflow Foundation introduced a lot of changes. In fact, the development team reexamined the core of the programming model, during runtime and tools, the architecture was modified to improve performance and productivity. The development team solved a large number of problems reported by users of earlier versions.
- Detailed description of. Net 4.0 environment Configuration
- Detailed description of. Net 4.0 parallel computing support history
- Details about the new functions of the. NET 4.0 Array
- Detailed description of new dynamic features in. Net 4.0
- Describes the new features of exception handling in. Net 4.0.
When to use a Workflow
The following application types may require workflow:
Any application that implements a long-term running process naturally requires a workflow;
The ASP. NET application displayed on the page may need a workflow to control the display order of the page;
A comprehensive application in a service-oriented environment may need to use a workflow to implement its core behavior;
Applications that solve specific problems, such as CRM, or a specific vertical market such as financial services, may need to use workflows.
For ISVs (independent software developers), workflows can provide users with the ability to customize applications, without having to do anything about the core functions of the program. You can authorize your users to do the following:
Make decisions based on their own business rules and adjust the workflow;
Methods for communicating with other software and systems outside the workflow;
Interaction with people;
Maintain the status of the entire workflow lifecycle.
New features in. Net 4 workflow
In. in net framework 4, Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) frameworks have been greatly improved ,. NET developers can use these technologies independently or jointly.
The workflow in. NET is composed of activities, runtime, and tools. The following is a summary of the changes in the workflow in. Net 4.
Figure 1. Workflow Composition Structure in. net
1. XAML workflow is the new default method
You can create a declarative workflow in a XAML file.CodeThis means that the workflow can be stored, retrieved, and modified like data.
2. Unified models between WF, WCF, and WPF
As a developer, within the program, we need a declarative programming model that is as powerful and flexible as Windows Presentation Foundation (WPF) is writing user interfaces, Windows Workflow Foundation (WF) it provides a declarative framework for building applications and service logic, and provides developers with a higher level of language processing Asynchronous Parallel tasks and other complex processing.
3. extended basic activity Library
The following new activities are introduced in. Net 4:
Stream Control: Flowchart, foreach, dowhile, and break
WCF: send, receive, sendreceive, recieveparameters, correlationscope and initializecorrelation
Others: Assign, methodinvoke, persist, InterOP, and powershellcommand
More activity plans are released to codeplex.
4. Simplified WF Programming Model
WF 4.0 makes the following things easier:
Manage workflows and run workflow instances;
Manage workflow bookmarks;
Create a custom activity;
Manage data and parameters.
Activity is the core basic type of the programming model. It also represents workflow and activity. In addition, you no longer need to create workflowruntime to call a workflow. You only need to create an instance and execute it to simplify unit testing and application scenarios.
The workflow programming model is completely composed of declarative activities. Without code hiding, the workflow design is simplified.
5. Supported parameters, variables, and expressions
Cross-activity data flow is a challenge. It depends on attributes and data binding, which is not natural for most developers.
In addition, managing the activity status is also a major challenge, and there is no way to define local storage in XAML.
WF 4.0 simplifies the data stream by adding parameters and variables and expressions.
Major improvements to WCF Integration
New message activities, managed support for message Association and improvement, and full definition of sexual services are the main areas for improvement.
In this way, you can understand that "WCF is outside, WF is inside", WCF exposes external interfaces, and WF describes internal processes and status transition.
When sending and receiving a WCF message, an association is usually required. in. Net 3.5, the Association is based on the Content Context message header.. Net 4.0 adds Association support for WCF and makes association easier to use through activity WF.
An XPATH expression identifies an associated token.
Correlationscope
Initializecorrelation
Runtime and designer improvements
The designer now supports larger workflows with better performance. The designer is based on Windows Presentation Foundation (WPF) and makes full use of rich user experience, people can establish a declarative UI framework. Activity developers use XAML to define their activities and methods of interacting with users in a visual design environment. In addition, you can re-host the workflow designer in your own applications to make it easier for non-developers to view and interact with workflows.
Managed through appfabric
The code before appfabric is called "Dublin", which provides WF hosting and Management Extensions for IIS and was.
Windows Server appfabric has three core functions: cache, workflow management, and service management.
For Web applications, Windows Server appfabric provides the caching function to accelerate access, improve application availability, and avoid unnecessary access to data sources;
For integrated applications, Windows Server appfabric makes it easier to build and manage services using Windows Workflow Foundation and Windows Communication Foundation;
Generally, if your applications are composed of services, web, data, and traditional components, you will find that Windows Server appfabric makes development, deployment, and management of these integrated applications easier.
For more information about appfabric, visit Windows Server appfabric (http://msdn.microsoft.com/en-us/windowsserver/ee695849.aspx ).
Flowchart
The flowchart provides a compromise between serialization and the state machine model. You will get:
A simple one-step model with judgment and switch;
Allows you to return previous activities in the workflow.
The flowchart is closer to the concept and thinking process. Many analysts and developers refer to the flowchart when creating a solution or designing a business process. Therefore, it makes more sense to provide an activity, this makes it easier to create conceptual thinking. The flowchart allows concepts such as returning previous steps, splitting logic based on a single condition, or a switch/Case Logic.
Figure 2 Flowchart
Create custom Activity
. Net 4.0 restructured the programming model for creating custom activities. You can derive custom activities from workflowelement or create custom activities from scratch.
In the second article of this article, I will introduce the concept of a basic workflow. You can use Visual Studio 2010 and. NET Framework 4 training kit for a test.
Use. Net 3.x Workflow
Your. net 3. X workflow will continue to work when using WF 3.0. you can use the. NET 4.0 workflow. net 3. X activity, but must be used. net 4.0 InterOP activity. The guide to how to prepare your. NET 3. x application will be released soon.
Source:Http://blogs.msdn.com/usisvde/archive/2010/01/10/first-look-at-workflow-in-net-4.aspx
Original Name:First look at workflow in. Net 4