Exemple #1
0
        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);
        }
Exemple #2
0
        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);
        }