c# - How to add activities to a workflow definition at runtime? -


i need add couple of activities (persist 1 of them) @ runtime executing workflow.

the way done until encapsulate loaded workflow (which dynamicactivity seems) , sequence this:

private activity wraprootactivity(activity activity) {     var sequence = new sequence     {         activities =         {             new persist(),             activity         }     };      return sequence; } 

one problem discovered can no longer out arguments workflow since root activity sequence. , more think find strange use else root activity.

the solution came use helper method wrote:

public static void insertstartingactivities(this dynamicactivity original, params activity[] startingactivities) {     var sequence = new sequence();     foreach(var startingactivity in startingactivities)     {         sequence.activities.add(startingactivity);     }     sequence.activities.add(original.implementation());      original.implementation = () => sequence; } 

what think, makes sense? 1 problem found can not resume in progress workflow instances going production in few days :)


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -