.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Post New Web Links

ActivityBuilder or DynamicActivity for authoring workflow using imperative code

Posted By:      Posted Date: December 04, 2010    Points: 0   Category :Windows Application

Hi all, 

I'm currently investigating what's the best way to author a workflow using imperative code. I found this link :


but, I'm still curious, which one is better as the main ingredient to author workflow using imperative code, is it ActivityBuilder or DynamicActivity?

The requirement is to write a workflow but we don't need it to be a type. We want to execute the created workflow, as well as perform modification (using code) such as adding/deleting argument, modify the variable, add/delete the sequence etc.

What are the differences between ActivityBuilder and DynamicActivity?


View Complete Post

More Related Resource Links

Change the Workflow Status through code


HI Folks,

I have a scenario where i need to develop a 6 stage approval workflow(sequential) using WWF and depoly it to sharepoint. Everythigns fine till here.

Now we look ahead to change the Status field on the documents library which actually has the Workflow Name as the column name and its value being In Progress, depending on the stage of approval. Like(Approved 1, Approved 2, Approved 3.)

And if rejected the status should be rejected than Completed. Any idea how can we update this column of the List item.

I have tried item[workflowProperties.Workflow.ParentAssociation.Name]="Approved 1";

But this throws an error saying input string is not in a correct format.

Any information would be of great help :)


Sreeharsha Alagani

Infopath form return XMl code during workflow task


1.     Review 7777.xml.

2.     Perform the specific activities required for this task.

Use the Edit this task button to mark the task as completed. (If you cannot update this task, you might not have access to it. Click here to request access.

Infopath button click event in custom workflow code.


Hi All,

I have designed the infopath form(Init) and integrated with my state machine workflow. i want to access button click event (designed in Infopath form) in my workflow code.

Can you help me.




Set State of workflow in code

Hi, i have instance of StateMachineWorkflowActivity and i cannot figure out how to change its State in code. Is there any way to do this?   Thank you in advance for your help!

Input parameters from Workflow No-Code Or Xaml Only

I have many activities and a customized workflow Only Xaml and I can not pass a value to a property of a custom activity, following the example of Workflow1.xoml   <pre lang="x-xml"><SequentialWorkflowActivity x:Name="Workflow1" xmlns:ns0="clr-namespace:CustomActivities;Assembly=CustomActivities, Version=, Culture=neutral, PublicKeyToken=null" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/workflow"> <ns0:ReadLineActivity x:Name="readLineActivity1" InputText="" /> <ns0:WriteLineActivity x:Name="writeLineActivity1" OutputText="{ActivityBind readLineActivity1,Path=InputText}" /> </SequentialWorkflowActivity> based on this workflow I pass a value for the property InputText activity readLineActivity1   Thanks a lot!

How do I assign the return value of a async code activity to the send activity in a workflow?



Here's my scenario:

- I have a WF service with a Pick activity. 

- The pick branch contains a Sequence activity in the trigger section. 

- The sequence contains a Receive activity that receives some information from another WF service.  It then performs an async code activity called CopyFiles.  CopyFiles returns a boolean value based on if the copy was successful or not. 

- The Action section of the pick branch has a Send activity, which will send this result to the calling WF service.

- The calling WF will look at this boolean value and decide whether to move to the next step or not.


How can I pass this boolean value to the Send activity?

Below is my async CopyFiles activity:

public sealed class CopyFiles : AsyncCodeActivity<bool>
    public InArgument<Services.Application> Application { get; set; }
    public InArgument<Services.Resource> ResourceFrom { get; <

Inline code in a workflow?


Hi. Is it possible to write inline code in my workflow? E.g. I'd like to drop a scripting shape in to the workflow and write some code in to that shape. The closest I could find to this was a shape that calls my C# method.

The ability to write inline code in a workflow is supported in BizTalk. I was hoping to find it in .Net 4 workflow. Have I missed something?


Myles Jeffery | Thinkscape | SharePoint Online Deployment | SharePoint Online File Migration Tool

create task using c# code in state machine workflow


hi all;

i need to create task activity using c# code under specific condition to more than one person (parallel task)

any idea and if u please could u support me with samples as i'm new in workflow using VS2010


thanks in advance

Databinding: Is code behind considered Imperative and is XAML considered Declaritive?

I'm just learning WPF and I wanted to know if databinding via code behind (create binding object, set properties, etc) is considered imperative programming and if the use of XAML extensions is considered declaritive programming.   I know the question is a bit odd, after all, who cares what it's called.  I'm just curious - I need to learn the lingo.  :D

Hidden Workflow Arguments to System.Activities.ActivityBuilder


Hi, I have rehosted the Workflow designer, and the base activity that i load is the Activity Builder(workflowDesigner.Load (activityBuilder);)

I basically need to add in some details to the activity, and the value of which the user should not be able to edit (or may be even see on the designer surface). For this I am (currently) adding some arguments as follows where i can add in the extra information.

activityBuilder.Properties.Add (new DynamicActivityProperty { Name = "HiddenArgument", Type = typeof (string), Value = "Value that the user should not edit." });

But as these arguments are visible on the designer surface in the Arguments Panel on the bottom of the designer, the user can edit this. i also have other arguments that the user is allowed to edit so therefore i cant disable the whole arguments pane.

I would just want to know how can i add my information to the workflow(and obviously save it in the *.XAML file) so that the user cant edit (or see) this information.

EXTRA DETAILS: I basically want something like, if i create a custom activity i can add properties with [Browsable(false)], which causes the user to not see the property on the right side pane but hold a value!

DynamicActivity.Implementation to ActivityBuilder.Implementaiton


As we know that DynamicActivity.Implementaion return Func<System.Activities.Activity> and ActivityBuilder.Implementation returns System.Activities.Activity.

So can we get System.Activities.Activity from Func<System.Activities.Activity> and assign it to ActivityBuilder.Implementaion somehow?




Software Engineer

DynamicActivity cannot reference a variable defined in parent workflow


I have a custom activity that executes a workflow by creating a DynamicActivity instance that is then invoked using WorkflowInvoker.

Prior to invoking the DynamicActivity instance, I set up its Properties using a dictionary of Arguments I have populated using the DynamicArgumentDialog. One of the DynamicActivitiy properties is an out argument and I assign it an an expression that references a variable defined in the parent workflow. The intention of this is that the DynamicActivity workflow will attempt to write a result to the variable defined in the parent.

Here's the code that initialises the Proprerties collection (out arguments only):


 foreach (string argumentKey in Arguments.Keys)
    if (da.Properties.Contains(argumentKey))
     if (da.Properties[argumentKey].Type.GetGenericTypeDefinition().BaseType == typeof(OutArgument))
      da.Properties[argumentKey].Value = Arguments[argumentKey];      

   WorkflowInvoker invoker = new WorkflowInvoker(da);


where Arguments is Dictionary<string, Argument>, populated using DynamicArgumentDialog.

However, when Invoke is called I get the exception:

The following errors were encountered while processing the workflow tree:
'VisualBasicReference<Int32>': Compiler error(s) encountered

Converting DynamicActivity into ActivityBuilder


How can we convert DynamicActivity To ActivityBuilder class?

Please advice.

Software Engineer

Code Optimized Web Development Profile (VS 2010 and .NET 4.0 Series)

When you first run VS 2010 it prompts you to select an IDE profile to use. The profile you select will configure how tool windows are displayed/docked in the IDE by default and set the default keyboard shortcuts. You can then customize any of these settings by using the Tools->Options menu within the IDE and then override/change them. You can also later reset your profile and pick a different one by choosing the Tools->Import and Export Settings menu command.

Free Code Snippets - ASP.NET

You Can Find Useful ASP.NET Related Posts on the above link.

Free Code Snippets - C#

Free C# Code Snippets

call JavaScript - jQuery code from ASP.NET Server-Side

jQuery got so close to me lately that I can see myself adding the scripts to my project almost unconsciously. The thing is, jQuery is very useful for me, in almost all situations and it has been a do or die enhancement for all my project since I first put my hands on it.

Of course while using it, you encounter few situations which need a bit of research to solve, mostly when you are trying to combine it with some other technologies like: UpdatePanels and ASP.NET Ajax. For instance there are many situations when I would like to run some jQuery magic based on some decision that I make on the server side.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend