Welcome to Windows Workflow Foundation (WF)
Top Tasks :

WF Community Bloggers

Introducing an ASP.NET PageFlow Starter Kit

This post will introduce the first part of a starter kit for doing Page Flows in ASP.NET with Windows Workflow. The first Release Candidate for Workflow is now out as part of the June .NET 3.0 CTP . If you are already working with the Beta's you will need to update your SQL Persistence and Tracking databases with the new scripts. I have put in a request to CodePlex to host the starter kit. I will add an update to this blog once it is approved. The first thing the starter kit contains is the necessary configuration to get a PageFlow project started. As I started learning workflow I discovered that there are several things required for using it from an application. Hosting the Runtime Windows Workflow does not offer any out of the box servers or special applications to take advantage of it. It is entirely up to developers to host the Workflow runtime inside of an application. This could be a Windows service, a .NET web service, a Windows application or an ASP.NET application. The only requirement is that host can work with the .NET 3.0 Workflow assemblies. In our case we will focus on hosting inside of ASP.NET. The runtime only needs to be created once per application in order to host multiple workflows. The blogs and examples I have found so far recommend creating the runtime in the global.asax.cs file. I have chosen in the starter kit to instead use an httpModule. By using a module it is easier to add Workflows to existing applications without having to cut and paste code. All that is needed is to create an instance of WorkflowRuntime and then shove it into an application variable that we can access later in our ASP.NET pages. We will use this variable in a PageFlowManager control so that direct interaction with the runtime is not even necessary from our applications. WorkflowRuntime workflowRuntime = new WorkflowRuntime("WorkflowRuntime"); context.Application["WorkflowRuntime"] = workflowRuntime; workflowRuntime.StartRuntime(); There are 2 important additional items to note in the code above. When creating the runtime the constructor takes a configSectionName as string. That string matches the workflow configuration element name in the web.config. I find that consistently naming it keeps it simple and easy to manage. The code would have to be changed if you named it something different. The second thing is that StartRuntime is called. This allows the runtime to read the configuration and initialize all of the services that you have added via the configuration itself. Configuration Lets take a look as what is in the basic configuration. First we define a config section for the WorkflowRuntime. Note that the name matches the name passed to the constructor when creating the runtime. <configuration> <configSections> <section name="WorkflowRuntime" type="System.Workflow.Runtime.Configuration.WorkflowRuntimeSection, System.Workflow.Runtime, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/> </configSections> We Read More...
Published Tuesday, June 27, 2006 1:17 AM by Option Strict : Cory Isakson
Anonymous comments are disabled

<June 2006>
SuMoTuWeThFrSa
28293031123
45678910
11121314151617
18192021222324
2526272829301
2345678

Copyright © 2006 Microsoft Corporation. All Rights Reserved. | Terms of Use | Privacy Statement | Contact Us