locked
Build execution graph from a model tree RRS feed

  • Question

  • Hi, guys.
    I have another question for you.

    If I have a rehosted designer app and I have some workflow created there,
    is there a way to build an execution sequence graph from model tree or from smth. else?
    Best regards, Alexander Efimov
    Wednesday, February 10, 2010 11:26 AM

Answers

  • Hi Alexander,

    You are talking about working out all the possible sequential execution patterns of your workflow, and displaying them as trees?

    There's no existing feature for this, you would need to create it.

    You would probably need to special case your code per Activity type because you show you want different behavior for 'control flow' activities If and Sequence from WriteLine, e.g. you don't want them to show up in the final Sequence.

    All that said, the main issue you are probably wondering is how to iterate over the child activities? Start from worfklowdesigner.Root and work your way down through the Properties collection, is one way.

    Another way is to look at ModelItem.Root.GetCurrentValue(), to get the actual activity object and actually iterate over it with code depending on its type, etc.

    Tim
    Tuesday, February 16, 2010 7:01 PM

All replies

  • Hey, guys. Is there ANY way to build execution graph in design-time(I mean a rehosted designer application)?

    Thanks in advance.
    Best regards, Alexander Efimov
    Monday, February 15, 2010 7:04 PM
  • You can get the model tree that way:


    ModelTreeManager mtreeManager = this.Designer.Context.Services.GetService<ModelTreeManager>();

    Now you can get the root of your model-tree using "ModelTreeManager.Root" Property. Then you can navigate through the roots child properties and then build a graph or something like that. Hope you can use that.
    Monday, February 15, 2010 7:58 PM
  • what do you mean build a execution grasph in design time?

     

    do you mean you want to get all children of the root item in the rehost app or you want to execute the designer created in rehost app?

    for execute the rehost designer, you can refer to following link, I have pasted the answer there, the code in the btn_click shows how to execute the designer created in rehost app

    http://social.msdn.microsoft.com/Forums/en-US/wfprerelease/thread/0221d239-c5ba-47b9-b690-487236c228e7

    for how to get all the children and children under children of the root designer such as sequence or flowchart

    you can refer to this link, I have pasted the answer there

    http://social.msdn.microsoft.com/Forums/en-US/wfprerelease/thread/fcbbab5e-62ee-4929-9bd5-ecf1b969e75c

    Tuesday, February 16, 2010 6:10 AM
  • What I want to do is to get the execution graph without executing workflow.

    For example I have something like this in the WF designer:

    <sequence>
       <assign/>
       <if>
          <if.condition>
              ....
          </if.condition>
         <if.then>
             <writeline/>
         </if.then>
         <if.else>
              <sequence>
                   <assign/>
                   <writeline/>
               </sequence>  
         </if.else>
    </sequence>

    And from this workflow I want to get a graph:
                  
                   - writeline
                /
    assign
                \  - assign - writeline
    Best regards, Alexander Efimov
    Tuesday, February 16, 2010 10:51 AM
  • so you want to draw a graph from the xaml or you want your designer surface display this way?

    if you want the designer surface display this way, ICompositeView can help you.
    if you want to draw a graph from XAML, IDocumentPersistence can help you.
    Tuesday, February 16, 2010 7:00 PM
  • Hi Alexander,

    You are talking about working out all the possible sequential execution patterns of your workflow, and displaying them as trees?

    There's no existing feature for this, you would need to create it.

    You would probably need to special case your code per Activity type because you show you want different behavior for 'control flow' activities If and Sequence from WriteLine, e.g. you don't want them to show up in the final Sequence.

    All that said, the main issue you are probably wondering is how to iterate over the child activities? Start from worfklowdesigner.Root and work your way down through the Properties collection, is one way.

    Another way is to look at ModelItem.Root.GetCurrentValue(), to get the actual activity object and actually iterate over it with code depending on its type, etc.

    Tim
    Tuesday, February 16, 2010 7:01 PM
  • Ye Yu, Tim, thanks for your answers.
    First of all - I don't want to display anything...all I wanted to do was to build an execution tree model in the background code of my app.
    Looks like there is no simple way to get this done.

    Anyway thank you very much for the answers. They are useful to me.
    Best regards, Alexander Efimov
    Tuesday, February 16, 2010 9:56 PM
  • Sorry, I might have given the wrong answer, I thought from the conversation you might mean a visual graph for rehosting and visualising the workflow.

    If really all you wanted was to find a list of all the activities in the workflow, and not to do any special casing for control flow, you might actuall want to use some functions designed for finding all the children of an activity, have a look at WorkflowInspectionServices

    Tim
    Thursday, February 18, 2010 6:35 AM
  • Hi, Tim. I'm pretty sure that you understood me well and gave me the right answer.
    I really was interested in building the execution flow graph but without any visualizing.

    I'm sorry, Maybe my English is not well enough to explain the things clearly.

    Thank you.
    Best regards, Alexander Efimov
    Thursday, February 18, 2010 10:42 AM