Task 1: Configure Runtime Services Using Code Home
This page is specific to:.NET Framework Version:3.03.5
Task 1: Configure Runtime Services Using Code

Download sample

In this task, you learn how to add services to the Windows Workflow Foundation by using methods that are defined in the WorkflowRuntime class. In this task and in the next task, you only use the DefaultWorkflowSchedulerService class. Starting with Task 3: Use the Windows Workflow Persistence Service, you learn how to use the other services that are provided by Windows Workflow Foundation.

ms734732.note(en-us,VS.90).gifNote:
Although you are encouraged to follow the exercises in a linear manner, it is not required. You can start this exercise by opening the sample project and proceeding to the steps in the following section.

To add runtime services

  1. In the Program file, import the System.Workflow.Runtime.Tracking namespace so that you can use the types in that namespace.

    using System.Workflow.Runtime.Tracking;
    
    
  2. In the Program class, create a static Int32 field named maxSimultaneousWorkflows, and assign it the value 1.

    static int maxSimultaneousWorkflows = 1;
    
    
  3. In the Main method that is defined in the Program class, add the DefaultWorkflowSchedulerService to the WorkflowRuntime.

    Use the AddService method, and pass the number of maximum simultaneous workflows that the DefaultWorkflowSchedulerService can schedule as a parameter.

    workflowRuntime.AddService(
        new DefaultWorkflowSchedulerService(maxSimultaneousWorkflows));
    
    

    For more information on this value and the DefaultWorkflowSchedulerService, see Using DefaultWorkflowSchedulerService.

Compiling the Code

For information about compiling your code, see Compiling the Code.

In Task 2: Configure Runtime Services using App.Config, you use an application configuration file to add services to the Windows Workflow Foundation.

See Also



Copyright © 2007 by Microsoft Corporation. All rights reserved.
© 2009 Microsoft Corporation. All rights reserved.   Terms of Use | Trademarks | Privacy Statement
Page view tracker
Rate the Lightweight library
x
Lightweight builds on ScriptFree (loband) by adding features you've requested: a SearchBox and default code language selection.
Do you like the SearchBox?
Do you like the tabbed code blocks?
How useful is this topic?
Tell us more.
Thanks
x
You're helping to improve MSDN Online.
Feedback
Switch View
Classic
Lightweight Beta
ScriptFree
Switch View