Welcome to MSDN Blogs Sign in | Join | Help

XAML activation and how to use it

XAML activation is when you use the serialized xoml file to create and run a workflow instance.  You will use one of the following WorkflowRuntime methods to create the workflow instance:

 

public WorkflowInstance CreateWorkflow(XmlReader workflowDefinitionReader);

public WorkflowInstance CreateWorkflow(XmlReader workflowDefinitionReader, XmlReader rulesReader, Dictionary<string, object> namedArgumentValues);

public WorkflowInstance CreateWorkflow(XmlReader workflowDefinitionReader, XmlReader rulesReader, Dictionary<string, object> namedArgumentValues, Guid instanceId);

 

Activation can be used for sequential or statemachine workflow, samples for each are attached to this post.  You are not able to use any code beside.  This will require you to add any needed variables or handlers to a compiled type, like your base activity. 

 

The only difference between a xoml file used with activation and one that is compiled into a type is the x:Class attribute.  The attribute  is used by the workflow author to explicitly state that the workflow must be compiled into a type and to define the class name for that type.

 

If you are getting an exception when the call to CreateWorkflow is made try the following to help resolve the error(s):

 

try

{

    WorkflowInstance instance = workflowRuntime.CreateWorkflow(xomlReader, ruleReader, parameters);

    instance.Start();

 

    waitHandle.WaitOne();

}

catch (WorkflowValidationFailedException exp)

{

    StringBuilder errors = new StringBuilder();

    foreach (ValidationError error in exp.Errors)

    {

        errors.AppendLine(error.ToString());

    }

    MessageBox.Show(errors.ToString(), "Workflow Validation Errors");

}

 

To bind to an event or condition handler in the base workflow you will need to manually update the xoml file since you can’t use the designer to do this.  The syntax to use is the following:

 

      EventOrConditionName="{ActivityBind NameOfWorkflowInstance,Path=EventOrConditionHandler}"

 

This posting is provided "AS IS" with no warranties, and confers no rights.

Published Tuesday, May 02, 2006 4:41 PM by tomlake
Attachment(s): XAMLActivation.exe

Comments

Tuesday, May 02, 2006 11:38 PM by Christopher Steen

# Link Listing - May 2, 2006

ASP.NET 2.0: Implementing Single Sign On (SSO) with
Membership API [Via: sahilmalik ]
Atlas Control...

# Learning Windows Workflow Foundation &laquo; Angel &#8220;Java&#8221; Lopez on Blog

Monday, October 09, 2006 5:50 AM by Angel "Java" Lopez

# Aprendiendo Windows Workflow Foundation

En estos dias, he ordenado algunos enlaces y recursos sobre el Windows Workflow Foundation, el motor

Thursday, August 14, 2008 5:08 PM by baloodevil

# re: XAML activation and how to use it

Could you elaborate or provide an example of "add any needed variables or handlers to a compiled type"

I believe I need to take this approach instead of XAML activation.  Here is my process...

- get workflow template from database

- deserialize it

- get list of approvers from table

- add activity for each approver

- compile?

- instantiate

Anonymous comments are disabled
 
Page view tracker