简体   繁体   中英

Multiple Workflow 4.5

I have been using two workflows. "OrderWorkflow" is my main workflow in "OrderWorkflow" am calling another workflow "OrderWF" now when i am loading "OrderWF" it is showing error as ---'OrderWF' is not of type 'OrderWorkflow'. When loading this instance you must ensure that the activity with name 'OrderWF' implements 'OrderWorkflow'. Below is my code

    public static void LoadExistingOrder(
        Guid orderId, string status, string value)
    {                       

        WorkflowApplication app = new WorkflowApplication(new OrderWF());

        var store = CreateInstanceStore();

        app.InstanceStore = store;

        app.Completed = (workflowApplicationCompletedEventArgs) =>
        {
            Console.WriteLine("\nWorkflowApplication has Completed in the {0} state.", workflowApplicationCompletedEventArgs.CompletionState);
        };

        app.Unloaded = (workflowApplicationEventArgs) =>
        {
            Console.WriteLine("WorkflowApplication has Unloaded\n");
        };

        app.PersistableIdle = (e) =>
        {
            return PersistableIdleAction.Unload;
        };


        app.Load(orderId);//getting error here

        app.ResumeBookmark(status, value);


    }

I think you are expecting the WorkflowApplication.Load(Guid) method to do something else than what it is actually doing.

The .Load(Guid) method load a previously persisted instance of the workflow the be reloaded in memory, and resumes its flow. It does not load a workflow of another type, and starts that.

Basically what your code does, is create a workflowapplication object with a workflow instance of type OrderWF , creates and attaches a store, and tries to resume the workflow with the given guid value orderId .

I'm suspecting that the workflow that you are trying to resume is of type OrderWorkflow , not of type OrderWF .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM