Visual Studio Designer for Windows Workflow Foundation Overview
Applies to: SharePoint Foundation 2010
The Visual Studio 2010 Workflow Designer provides a means to rapidly develop workflows by using a graphical interface that leverages a developer's knowledge of the Microsoft Visual Studio development environment.
WF Workflow Markup
Each WF workflow can be represented by the following combinations of files:
An XML file, or markup,that includes the declarative metadata of the workflow; or
The markup file, in combination with a code-behind file that contains custom code representing the properties and behavior of the workflow; or
A code file (or files) that include both the declarative logic and behavior of the workflow.
The markup file is written in eXtensible Application Markup Language (XAML), which has a published schema to which the file must adhere, and given a file extension of .xoml.
Because the XAML has a published schema, you can create XAML files using any text or XML editor you choose. However, the Visual Studio 2010 Workflow Designer offers developers a graphical interface in which to create workflows, and automatically generate the appropriate markup file.
Developers can choose to integrate or separate their declarative metadata from the business logic included in the workflow. Conceptually, the "code separation" paradigm WF workflows employ is similar to that used in ASP.NET: declarative metadata is separate from the file that encapsulates your business logic. So, while the markup file contains the metadata for the activities included in the workflow, the properties and behaviors of those activities are detailed in a separate file.
For workflows authored using code separation, information is persisted in the two files:
- The markup file, as detailed above.
And one of the following two types of files:
A code-beside file, which contains the code that encapsulates your business logic. This file may be written in either Microsoft Visual C# or Microsoft Visual Basic.
A workflow rules file, which encapsulates your business logic in declarative rules, rather than code.
Each workflow created this way is actually a unique Microsoft .NET type, constructed from two partial classes, which are represented by the XOML and a code-behind or rules file. When the workflow project is compiled, these two partial classes are combined into a .NET assembly. This is the approach taken when authoring workflows for SharePoint Foundation 2010 using the Visual Studio 2010 Workflow Designer.
Workflows comprised only of code files follow the same general compilation process: that is, the code files are compiled into a .NET type.
In addition, you can compile workflows comprised solely of markup files. However, this is not necessary; the WF runtime engine can load and run uncompiled markup workflows. This is the approach taken when authoring workflows for SharePoint Foundation 2010 using a declarative-rules-based, code-free workflow editor, such as Microsoft SharePoint Designer 2010.