Home > WF4

[WF4]Inspect Workflows

10. June 2010

To inspect the Workflow tree, we can use WorkflowInspectServices:

   /// <summary>
/// Use this method to list all sub activities
/// WorkflowInspectServices: Provides methods
/// for working with the runtime metadata for an activity tree.

/// </summary>
/// <param name="rootWF"></param>
/// <param name="indent"></param>
private static void InspectWorkflow(Activity rootWF, int indent) {
IEnumerator<Activity> activities =
WorkflowInspectionServices.GetActivities(rootWF).GetEnumerator();
Console.WriteLine(new string(' ', indent) + rootWF.DisplayName + " id:"
+ rootWF.Id);
while (activities.MoveNext()) {
InspectWorkflow(activities.Current, indent + 2);
}
}

To Inspect workflow Variables and Arguments, we can use ActivityBuilder:

   /// <summary>
/// Use this method to list all Variables, InArguments and OutArguments
/// </summary>
private static void LoadWFFromXaml(){
string xamlWorkflow =File.ReadAllText(@"Path\Workflow1.xaml");
StringReader sr = new StringReader(xamlWorkflow);
XamlXmlReader xxr = new XamlXmlReader(sr);
XamlReader xr = ActivityXamlServices.CreateBuilderReader(xxr);
ActivityBuilder ab = XamlServices.Load(xr) as ActivityBuilder;

foreach (var p in ab.Properties) {
Console.WriteLine("Name:" + p.Name);
Console.WriteLine("Type:" + p.Type);
Console.WriteLine("Attribute:" + p.Attributes);
Console.WriteLine("Value:" + p.Value);
Console.WriteLine("---------------------------------");
}
}

WF4

Comments

10/20/2011 2:29:36 AM #

I agree with your Blog and I will be back to check it more in the future so please keep up your work. I love your content & the way that you write. It looks like you’ve been doing this for a while now, how long have you been blogging for?
12/8/2011 1:39:43 AM #
<p><a href="http://www.womens-ugg-boots.org/">Womens Ugg Boots</a> 'Five per cent of ninety pounds is <p><a href="http://www.cheap-ugg-boot.net/">Cheap Ugg Boot</a> four pounds ten shillings,' <p><a href="http://www.cheap-ugg-boot.net/">Discount Ugg Boots</a> said Mr Levy cheerfully.<p><a href="http://www.womens-ugg-boots.org/">Discount Uggs Boots</a> 'You can pay now or on receipt of your first term's salary. <p><a href="http://www.womens-ugg-boots.org/"> Ugg Outlet</a> If you pay now there is a reduction of 15 per cent.<p><a href="http://www.womens-ugg-boots.org/">Cheap Uggs Boots On Sale</a> That would be three pounds six shillings and sixpence.''I'll pay you when I get my wages,' <p><a href="http://www.cheap-ugg-boot.net/"> Womens Winter Boots</a> said Paul.'Just as you please,' <p><a href="http://www.cheap-ugg-boot.net/">Sheepskin Boots On Sale</a> said Mr Levy. 'Only too <p><a href="http://www.brand-dress.com/">Brand Dress</a> glad to have been of use to you.'
1/18/2012 5:07:29 AM #
This is a fantastic post. Really excellent.Thank you so much for sharing.

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading