Cette documentation est archivée et n’est pas conservée.

WorkflowRuntime.CreateWorkflow, méthode (XmlReader, XmlReader, Dictionary, générique)

Creates a workflow instance by using the specified XmlReader objects and the arguments contained in the specified Dictionary.

Espace de noms: System.Workflow.Runtime
Assembly : System.Workflow.Runtime (dans system.workflow.runtime.dll)

public WorkflowInstance CreateWorkflow (
	XmlReader workflowDefinitionReader,
	XmlReader rulesReader,
	Dictionary<string,Object> namedArgumentValues
public WorkflowInstance CreateWorkflow (
	XmlReader workflowDefinitionReader, 
	XmlReader rulesReader, 
	Dictionary<String,Object> namedArgumentValues
public function CreateWorkflow (
	workflowDefinitionReader : XmlReader, 
	rulesReader : XmlReader, 
	namedArgumentValues : Dictionary<String,Object>
) : WorkflowInstance
Non applicable.



An XmlReader that contains the workflow definition.


An XmlReader.


A Dictionary of objects keyed by string that represents the arguments to the workflow.

Valeur de retour

A WorkflowInstance object that represents the workflow instance created.

Type d'exceptionCondition


workflowDefinitionReader is a null reference (Nothing in Visual Basic).


The WorkflowRuntime is disposed.

The workflow instance is created from the workflow definition referenced by the XmlReader and the arguments supplied by namedArgumentValues.

Before the WorkflowInstance is created, validation is executed on it. If any validation errors occur, the WorkflowValidationFailedException is thrown. This works well for simple scenarios, but in a server environment, revalidating a workflow for every activation might be unnecessary overhead.

For information about disabling validation, see ValidateOnCreate.

For an example of passing in parameters to CreateWorkflow, see Workflow with Parameters Sample.

For an example of using rules defined in XML, see IfElse with Rules Sample.

Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile pour Pocket PC, Windows Mobile pour Smartphone, Windows Server 2003, Windows XP Édition Media Center, Windows XP Professionnel Édition x64, Windows XP SP2, Windows XP Starter Edition

Microsoft .NET Framework 3.0 est pris en charge sur Windows Vista, Microsoft Windows XP SP2 et Windows Server 2003 SP1.

.NET Framework

Prise en charge dans : 3.0