一、Workflow Foundation versions
- The current version of WF was released as part of the .NET Framework version 4 and is referred to as (WF4).
- Workflow Foundation was first released in Version 3 of the .NET Framework, and primarily uses the System.Workflow.Activities, System.Workflow.ComponentModel, and System.Workflow.Runtime namespaces. Workflows in version 3 were created using either the Sequential model (in which activities executed in order, with the completion of one activity leading to the next), or the State Machine model (in which activities executed in response to external events).
- In .NET 3.5, messaging activities were introduced that integrated Workflow with Windows Communication Foundation (WCF). With the new ReceiveActivity, workflows could respond to incoming WCF messages. The new features of Workflow in version 3.5 use the System.ServiceModel namespace.
- In .NET 4, Windows Workflow Foundation was largely updated, with new features such as Data Contract Resolver, Flowchart, and other flow control activities added. Workflow in .NET 4 uses the System.Activities namespace. Most notably, there is no longer a Workflow Runtime object in version 4; workflows are executed directly using WorkflowApplication or WorkflowInvoker instead.
- Activities created in previous versions of the .NET Framework can be executed by .NET 4 workflows using the Interop activity.
- Future versions and releases of WF will include an updated State Machine and Dynamic Update.
二、Products using Workflow Foundation
- Microsoft Office SharePoint Server from the 2007 release. Versions prior to 2007 did not use WF.
- Microsoft Speech Server from the 2007 release. Versions prior to 2007 did not use WF.
- Microsoft Forefront Identity Manager from the 2010 release. Versions prior to 2010 did not use WF.
- Microsoft Dynamics CRM from the 4.0 release. Versions prior to 4.0 did not use WF.
- Microsoft Dynamics AX from the 2009 release. Versions prior to 2009 did not use WF.
- Laserfiche Workflow from the Laserfiche Workflow 8.0 release.
- Team Build from the 2010 release, for the definition of build processes
- JAMS Scheduler Designs, schedules, and monitors Windows Workflows.
三、 What is Workflow?
简单的说一个完整得工作流平台(Workflow Foundation)由3个部分组成: Activity(活动),Runtime(运行时)和Tooling(开发工具)。所以在我的团队里,我们将称为A.R.T——艺术。
Activity是工作流的一个工作单位,几个小的Activity能够组合在一起成为一个大的Activity,从而完成更复杂的逻辑。而一个顶层的Activity被称为工作流(Workflow),就像程序中的Main函数。
WF Runtime是Activity的执行平台,WF Runtime可以被托管在.NET的应用程序中,比如IIS。就像我们在运行.NET程序是,CLR会帮助我们管理内存,我们在WF Runtime中运行Activity时,Runtime也会帮我们关系进行诸如应用程序持久化,日志记录,数据追踪方面的工作。
大部分人可能会将Tooling理解为Visual Stuido中的工作流设计器。对,它是Tooling的一部分,但是一个好的开发工具还应该提供了调试功能,你将可以在设计器中更加直观的调试你的工作流。并且你还应该能够将Visual Studio 中支持设计器的在别的平台是使用,比如Web Page或者一个WinForm的程序上。 我们将它称为Rehosting。
Microsoft Windows Workflow Foundation (WWF) 是一个可扩展框架,用于在 Windows 平台上开发工作流解决方案。作为即将问世的 Microsoft WinFX 的组成部分,Windows Workflow Foundation 同时提供了 API 和一些工具,用于开发和执行基于工作流的应用程序。Windows Workflow Foundation 提供单个统一的模型,以便创建跨越多个类别应用程序的端到端解决方案,包括人力工作流和系统工作流。
Windows Workflow Foundation 是一个广泛且通用的工作流框架,并且从下到上、在每个级别都针对可扩展性进行了设计。基于 Windows Workflow Foundation 的解决方案,由得到 Microsoft .NET 代码支持且在宿主应用程序中运行的互连组件组成。就像在定制的环境中以可视方式创建 Web 页一样,您需要在可视设计器中制订特定工作流的步骤,并且添加代码隐藏工作流组件以实现规则并定义业务过程。
Windows Workflow Foundation 提供一个工作流引擎、一个 .NET 托管 API、运行库服务以及与 Microsoft Visual Studio 2005 集成的可视化设计器和调试器。可使用 Windows Workflow Foundation 来生成并执行同时跨越客户端和服务器的工作流,以及可在所有类型的 .NET 应用程序内部执行的工作流。
工作流指的是:是以活动示意图形式定义的人力或系统过程模型。活动 是工作流中的一个步骤,并且是工作流的执行、重用和创作单位。活动示意图表达规则、操作、状态以及它们的关系。Windows Workflow Foundation 工作流通过安排活动而设计,然后它编译为 .NET 程序集,且在工作流运行库和公共语言运行库 (CLR) 中执行。
四、 Why needs WF?
总来来说Workflow是为了简化协调工作而产生的,让我们来看个例子。
我们有这样一段代码,用于实现一个银行帐户的验证
首先,我们要求用户输入用户名,输入帐户之后便调用验证函数。这一切看起来都很完美似乎没Workflow什么事情。但是现在我们需要在Web建立这个程序,也许你要有页面用于输入用户名,一个页面用户输入帐号,最后在进行验证。那么你就需要建立3个函数,一个用于读取用户名,一个用于读取帐号,另一个用于验证。因为你将3个函数的逻辑分开了,那么你需要一个变量来保存当前是在输入用户名还是在输入帐号,当然你还需要添加代码来判断是否当前处于正确的状态。不可避免的,你还要添加若干代码来完成不同状态的转换。更糟糕的是你也许希望用户在关闭浏览器后重新登陆不需要再次输入用户名或帐号,那么你又将添加大段的代码来建立你的数据表,并把将这些所有数据储存在数据库。
五、 WF Benefits:
1. 简化协调工作所带来的额外工作量
工作流将业务逻辑从具体的实现中剥离出来,使你能够更专注于业务逻辑的建立,而将大量繁琐的工作交给Workflow Runtme来完成。
2. 应用程序的持久化
工作流是默认持久化运行的。你不在需要大量的代码来完成以上的工作。
3. 增强程序的透明性
因为业务逻辑和具体实现的分离,那怕是一个完全不懂编程的业务分析师也能够看懂你的程序,甚至能够自己改动你的业务逻辑。
六、 How to deploy WF
There are a lot of ways to deploy workflow:
1. If you are testing a workflow, you can just run it in console application.
2. If you want to publish workflow as a service, I would recommend you deploy workflow in IIS.
3. If your workflow will only be consumed by a local application, you can deploy workflow as a windows service
4. If you are working with sharepoint, you can deploy workflow to sharepoint. (http://msdn.microsoft.com/en-us/library/ms460303.aspx)
simply put, workflow is a normal .net application.
you can check these links for more info:
http://msdn.microsoft.com/en-us/library/cc709458.aspx
http://msdn.microsoft.com/en-us/library/bb153577.aspx
http://msdn.microsoft.com/en-us/library/ms735951.aspx
http://msdn.microsoft.com/en-us/library/bb153574.aspx
七、 Workflow Development Tools Comparison
The following table offers a detailed comparison between the capabilities offered by the Visual Studio 2010 Workflow Designer and Microsoft SharePoint Designer 2010, and the workflows you can create with each.
Visual Studio 2010 Workflow Designer |
SharePoint Designer |
Can write workflows for SharePoint Foundation 2010 |
Can write workflows for SharePoint Foundation 2010 |
Code-behind file enables developer to write custom Microsoft Visual C# or Microsoft Visual Basic code to express business logic |
No code behind; workflow rules file declaratively encapsulates business logic instead |
Generates workflow markup file |
Generates workflow markup file |
Workflow is authored as a template, which can be associated with multiple sites and lists |
Workflow is authored against and data-bound to specific list at design time Workflows can also be created as site workflows which make them reusable across multiple sites. |
Workflow markup file, or markup and code-behind files, compiled into workflow assembly |
Workflow markup, workflow rules, and supporting file are stored, uncompiled, in a specific document library on the site |
Workflow template must be associated with each list on which it is to be available. |
Association happens when the workflow is authored against the specific list; no later association is necessary or possible |
Workflow template can be associated with a site content type. |
Cannot author workflows against content types. |
Can use any forms technology. For example, Microsoft ASP.NET forms for SharePoint Foundation 2010 workflows. |
Uses the Forms Web Part. |
Can include workflow modifications |
Workflow modifications are not available |
Can author custom activities for inclusion in workflows |
Must use activities provided in the user interface. However, custom activities can be exposed to the design surface by modifying the ACTIONS files which contain the list of activities that can be used. |
Package workflow assembly and workflow definition as a SharePoint Feature, and deploy to the site |
Automatically handles deployment to specific list |
Can use Initiation form to gather information from the user when they start the workflow |
Can use Initiation form to gather information from the user when they start the workflow |
Can use custom forms for users to interact with tasks in SharePoint Foundation 2010 |
Can use custom forms for users to interact with SharePoint Foundation 2010 tasks |
Visual Studio debugging available |
No step-by-step debugging available |
Can author both sequential and state workflows |
Can author only sequential workflows |
此外,WF 提供的不同的运行时服务几乎都具有可扩展性或可替换性。例如,您可以在其他存储媒体之上实现您自己的工作流持久层,或者可能实现工作流计划程序,该程序根据自定义线程池实现而非内置 .NET ThreadPool 执行。这样的自定义服务的配置方式与其他所有 WF 服务配置方式完全相同,因此该模型具有一致性,也很简单。
最后,在面对不断发展的技术和应用程序体系结构时,WF 的目标是保持灵活性,而不是因固守僵化的要求导致构建的技术不能广泛应用。
FYI:
http://foundation.cnblogs.com/
http://msdn.microsoft.com/zh-cn/magazine/dd252947.aspx