实例化一个System.Workflow.Runtime.WorkflowRuntime对象,这样的程序称为宿主程序(host)
WorkflowRuntime就是上一章的MythicalRuntime, WorkflowInstance就是上一章的ProgramHandle
要使用TypeProvier类将包含活动的dll加载到runtime:如下:
using (WorkflowRuntime runtime = new WorkflowRuntime())
{
TypeProvider tp = new TypeProvider(runtime);
tp.AddAssemblyReference("Essential.dll");
runtime.AddService(tp);
runtime.StartRuntime();
}
{
TypeProvider tp = new TypeProvider(runtime);
tp.AddAssemblyReference("Essential.dll");
runtime.AddService(tp);
runtime.StartRuntime();
}
通过XmlReader读取xoml文件,再WorkflowInstance = runtime.CreateWorkflow(reader);得到一个基于该xoml的活动赋予instance
钝化passivate