This knowledge base created on MiniTool official webpage introduces you with a kind of Microsoft technology – Windows Workflow Foundation and its related information. It covers its meaning, downloading, installation, runtime engine, and work policy.
What Is Windows Workflow Foundation?
Windows Workflow Foundation (WF) is a Microsoft technology that offers an application programming interface (API), an in-process workflow engine, as well as a re-hostable designer to apply long-running processes as workflows within .NET apps.
A workflow is a series of distinct programming steps or phases. Each step is modeled in Microsoft Windows Workflow Foundation as an activity. The .NET Framework provides a library of activities such as WriteLine, an activity that writes text to the console or other form of output.
Also, custom activities can be developed for additional functionality. Activities can be assembled visually into workflows relying on the workflow designer, which is a design surface that runs within Visual Studio. The designer can also be hosted in other apps.
Encapsulating programming functionality into the activities enables the developer to create more manageable apps. Each component of execution can be developed as a common language runtime object whose execution will be managed by the workflow runtime.
According to Microsoft itself, a workflow is a set of elemental units named activities that are saved as a model that describes a real-world process. Workflows provide a way of describing the order of execution and dependent relationship between pieces of long- or short-running work. This work passes through the model from start to finish, and activities might be executed by people or by system functions.
The current version of Windows Workflow Foundation is published as part of the .NET framework v4.5 and is referred to as WF45.
Windows Workflow Foundation Download and Install
You can download and install Windows Workflow Foundation Sample Integrating WF and Windows Communication Foundation (WCF) from this official webpage. Just select the proper language and click the Download button.
Windows Workflow Foundation System Requirements
- Operating system (OS): Windows Server 2003 Service Pack 1, Windows Vista, and Windows XP Service Pack 2
- .NET Framework 3.0 Runtime Components (included in Windows Vista)
- Visual Studio 2005 Professional or Team Editions
- Visual Studio 2005 Extensions for Windows Workflow Foundation
- SQL Server 2005 Express Edition or better
Installation of Windows Workflow Foundation
- Double-click to run the .exe file named WFExpenseReporting.
- Accept all of the terms of the preceding by clicking the Yes
- Select a folder on your computer or just keep the default selection to contain the extracted files. Then, click the Unzip
- Click the Close button to finish the installation.
- Go to the location where you select to save the extracted files, view the README.txt file for instructions for compiling and using this sample. Make sure you have set the database connection in DB install scripts and .Config files to your database location. This may be “.” or “.\SQLEXPRESS” or something else.
Runtime Engine of Windows Workflow
The workflow in-process runtime engine creates and maintains every running workflow instance. It interacts with the host process via one of the below ways.
- A WorkflowInvoker that invokes the workflow like a method.
- A WorkflowServiceHost for message-based interactions in multi-instance scenarios.
- A WorkflowApplication for explicit control over the execution of a single workflow instance.
Each of those classes wraps the core activity runtime represented as an ActivityInstance responsible for activity execution. There can be several ActivityInstance objects within an app domain running concurrently.
Each of the preceding 3 host interaction objects is created from a tree of activities referred to as a workflow program. Making use of those types or a custom host that wraps ActivityInstance workflow can be executed inside any Windows process including console apps, forms-based applications, Windows Services, Windows Communication Foundation services, as well as ASP.NET Web sites.
How Does Windows Workflow Work?
The Invoke method of the WorkflowInvoker class invokes several workflow instances. WorkflowInvoker is used for lightweight workflows that don’t need management from the host; workflows that need management from the host (e.g. Bookmark resumption) must be executed using Run instead.
It does not need to wait for one workflow instance to complete before invoking another; the run-time engine supports running multiple workflow instances simultaneously. The workflows invoked are as below.
- A custom activity called ReadLine. An OutArgument of the ReadLine activity is returned to the calling Invoke method.
- A custom activity that derives from the CodeActivity abstract class. The CodeActivity can access runtime features like tracking and properties, using the CodeActivityContext that is available as a parameter of the execute method.
- A Sequence activity that contains a WriteLine child activity. A variable of the parent activity is bound to an InArgument of the child activity.