invoke sub StateMachine workflow

Hi, All,

I'm hosting the State Machine workflow in ASP.NETthat uses InvokeWorkflow activity for sub State Machine WF. But at the TargetWorkflow property of Parent WF, I could not choose a subWorkflow for that property in the current project at Designer UI, it always is empty. What am I missing?

BTW, if my stateMachineWF invokes Sub StateMachineWF, and this sub stateMachine WF will invoke another one. how many levels could it be?

for example, workflow 1, WF(1): A1-->A2-->A3-->A4-->A5
WF(2): A2-->A3-->A4-->A5
WF(3): A3-->A4-->A5
WF(4):A4-->A5

So, it will be possible for
WF(1): A1-->WF(2)
WF(2): A2-->WF(3)
WF(3): A3-->WF(4)
WF(4): A4-->A5 // this one will be same as old one

I just simplify this mode for description( it is stateMachine, but here,it looks like sequential WF)

Is there a sample for article for me to reference for this?

Best Regards,

Brain

[1058 byte] By [BrianBT] at [2007-12-21]
# 1
I've actually never been able to get a state machine workflow to successfully spawn a sub-workflow. I tried it in the Feb CTP and got nothing but crashes and exceptions. I'm interested in seeing if there's a good recommendation here.

What I ended up doing was just encapsulating the sub-workflow in a larger encapsulation state and mimicking the hierarchical composition of states pattern.

KevinHoffman at 2007-9-10 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 2
With Beta 2.2 you need to have the invoked workflows in a different project from the invoking workflow. This restriction has been removed in current builds.
TomLake at 2007-9-10 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 3

Tom,

Thanks,
BTW, based on your stateMachine WF sample on Asp.net, we need to add Workflow assemble at Application_Start(), for invoke sub workflow, do I need to add all the sub workflow assembleies at there?

like,

typeProvider.AddAssembly(typeof(ActivityLibrary1.Workflow1).Assembly);
typeProvider.AddAssembly(typeof(ActivityLibrary2.Workflow2).Assembly);
typeProvider.AddAssembly(typeof(ActivityLibrary3.Workflow3).Assembly);

Thanks

Brian

void Application_Start(object sender, EventArgs e)
{
// Code that runs on application startu
System.Workflow.Runtime.WorkflowRuntime workflowRuntime = new System.Workflow.Runtime.WorkflowRuntime("WorkflowRuntime");

Application["WorkflowRuntime"] = workflowRuntime;

System.Workflow.ComponentModel.Compiler.TypeProvider typeProvider = new System.Workflow.ComponentModel.Compiler.TypeProvider(workflowRuntime);

typeProvider.AddAssembly(typeof(ActivityLibrary1.Workflow1).Assembly);

workflowRuntime.AddService(typeProvider);
workflowRuntime.StartRuntime();
}

BrianBT at 2007-9-10 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...
# 4
You can add the assemblies to the TypeProvider there but don't have to. They just need to be added to the type provider before the runtime needs to resolve them. Anywhere you have access to the runtime you can get the type provider back, calling GetService, and add new assembly references.
TomLake at 2007-9-10 > top of Msdn Tech,Software Development for Windows Vista,Windows Workflow Foundation...

Software Development for Windows Vista

Site Classified