private static WorkflowServiceHost CreateServiceHostCustomPersistence( String xamlxName, IItemSupport extension) { WorkflowService wfService = LoadService(xamlxName); WorkflowServiceHost host = new WorkflowServiceHost(wfService); InstanceStore store = new FileSystemInstanceStore(); host.DurableInstancingOptions.InstanceStore = store; WorkflowIdleBehavior idleBehavior = new WorkflowIdleBehavior() { TimeToUnload = TimeSpan.FromSeconds(0) }; host.Description.Behaviors.Add(idleBehavior); //host.Faulted += new EventHandler(host_Faulted); if (extension != null) { host.WorkflowExtensions.Add(extension); } _hosts.Add(host); return(host); }
private static InstanceStore CreateCustomInstanceStore() { InstanceStore store = new FileSystemInstanceStore(); InstanceView view = store.Execute( store.CreateInstanceHandle(), new CreateWorkflowOwnerCommand(), TimeSpan.FromSeconds(30)); store.DefaultInstanceOwner = view.InstanceOwner; return(store); }