As professions become more and more specialized, it becomes increasingly difficult to explain what, exactly, a business process entails. Microsoft's Windows Workflow Foundation, or WF, addresses this complexity by letting developers create graphical representations of a business process.
"This is much easier to show to your stakeholders. The graphical depiction gives you a good idea of what is going to occur," Brian Noyes, chief architect of IDesign, told attendees at the .NET 3.0 Roadshow, a Dr. Dobbs seminar that came to the Boston area last week. WF is one of four new products Microsoft is introducing in .NET 3.0.
WF can trace its roots back to the orchestration engine that Microsoft included in BizTalk Server. That dealt only with messaging, while the finished Workflow Foundation is much more comprehensive, Noyes said -- so much so that the next version of BizTalk will eschew its own framework and use WF for workflow.
Noyes stated that WF is best for complex processes like customer relationship management and enterprise resource planning; simple business logic can actually be more complicated in WF.
WF allows for two types of workflows. A sequential workflow is just that -- a system with a distinctive start, intermediate steps and finish. Each activity in a workflow is a state within a class, Noyes said.
A state machine workflow, on the other hand, represents an ongoing project, in which a system continually transitions from one state to another. In this case, activities are not attached to a state, Noyes noted. Instead, a state must be initialized, driven and finalized.
Like Windows Presentation Foundation, its companion tool in .NET 3.0, Windows Workflow Foundation lets developers build these workflows graphically, using drag-and-drop functionality. In addition, WF generates a markup files automatically, as does WPF. (There are slight differences between the markup files the two tools create. For more information on this, read Microsoft's WF, powered by XOML, promises simplified workflows.)
WF also gives developers a base activity library. This covers the flow of activities within a workflow, the way a workflow communicates with its host and the way it handles transactions and exceptions. Noyes said Microsoft will be post additional activities, including some BPEL activities, on the .NET 3.0 community page, which can be seen here. Developers can also create custom activities; Noyes said this is akin to building custom controls and forms in .NET 2.0.
After providing an introduction to Windows Workflow Foundation, Noyes devoted a separate session to WF's hosting model, its communication options and its custom activity capabilities (the latter of which is discussed above).
Any .NET application process, whether it's Windows Forms, ASP.NET or a console app, can host a workflow, Noyes said. Developers need to know, though, that the workflow runtime can only be loaded once per app domain. For a Web app, he said, that should be the first page that appears after the server loads.
As for the communication model, developers have several options -- input/output parameters, an external data exchange, a Web services request or a custom code activity. Additional details and code samples regarding these models are available here.
Noyes said direct integration of WF and the Windows Communication Foundation is not yet available, though WCF activities should be posted on the .NET 3.0 community page soon.