示例#1
0
        private static WorkflowApplication GetApp()
        {
            // Create a new workflow
            Activity workflow1 = new Workflow1();

            // Create a new host
            WorkflowApplication app = new WorkflowApplication(workflow1);

            SqlWorkflowInstanceStore store =
                new SqlWorkflowInstanceStore(ConfigurationManager.ConnectionStrings["Demos"].ConnectionString);

            // Delete all when workflow instance is terminated
            // store.InstanceCompletionAction = InstanceCompletionAction.DeleteAll;

            // Pomote extensions properties (InstancePromotedPropertiesTable)
            store.Promote("MyExtension", MyExtension.GetValuesToPromote(), null);

            app.InstanceStore = store;

            // Add extension
            MyExtension extension = new MyExtension();

            app.Extensions.Add(extension);
            app.PersistableIdle = PersistableIdle;
            app.Unloaded        = Unloaded;
            return(app);
        }