Using Workflow Rules


If you define your rules in Visual Studio, thereby creating a .rules file associated with your workflow, the runtime finds this file and uses it when your workflow is executed - that is, if your workflow is started by pointing to a .NET class type in the WorkflowRuntime.CreateWorkflow method.

With the XAML workflow style, on the other hand, you can specify the rules XML to be used when you call the CreateWorkflow method. The following code is an example of how this is done:

  WorkflowRuntime workflowRuntime = new WorkflowRuntime(); XmlReader workflowReader = XmlReader.Create("MyWorkflow.xoml"); XmlReader rulesReader = XmlReader.Create("MyWorkflowRules.xoml"); WorkflowInstance instance = workflowRuntime.CreateWorkflow(      workflowReader, rulesReader, null); instance.Start(); 

There is an overload of the CreateWorkflow method that takes two XmlReader instances: one for the workflow definition itself and one for the workflow rules. The preceding code uses this method to create a workflow instance from the MyWorkflow.xoml definition file, with the rules that are in the MyWorkflowRules.xoml file.



Professional Windows Workflow Foundation
Professional Windows Workflow Foundation
ISBN: 0470053860
EAN: 2147483647
Year: 2004
Pages: 118
Authors: Todd Kitta

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net