locked
Accessing WorkflowApplication by ID RRS feed

  • Question

  • I don't have any experience with WF, but a lot of experience in .NET back end/front end overall. 

    .NET 4 / C# project.

    What I am trying to achieve: 

    1. A simple Workflow which can be started and stopped through a service. 

    So far I have a public method "Start" and a public method: 


                       
    MyWorkflow wf = new MyWorkflow ();
    
    public void StartService()
            {
                _wfApp = new WorkflowApplication(wf);
                _wfApp.SynchronizationContext = SynchronizationContext.Current;
                _wfApp.Run();
    
            }

    What needs to be done is that I persist my _wfApp.Id and then be able to stop this particular instance from my public void Stop() method. I did read on persisting workflows etc, but I am having a hard time finding a simple example where I would be able to get my workflow by an Id. There should be some sort of a collection of currently running worlflows. I did find something for .NET 3.5,  but not for 4.0 . 

    Basically the QUESTION is: How do I "find" and access a particular workflow application using its ID ?

    Thanks, 

    Monday, March 12, 2012 1:47 PM

Answers

  • you can use "_wfApp.Id" to get the id of your current WorkflowApplication and after that you can load that instance to terminate it.
    • Proposed as answer by Vivi Rv Tuesday, March 13, 2012 10:29 AM
    • Marked as answer by LeoTang Monday, March 19, 2012 7:51 AM
    Monday, March 12, 2012 3:25 PM

All replies