Skip to main content

Posts

Showing posts from July, 2010

Workflow Foundation 4 - Part 3 - Data storage and management

This is my third post on WF4. First one was an introductory post on WF4 and in second one we focused on executing workflows. In the this post I am going to focus on the topic of data storage and management. Every business process or flow depends on data. When you think of data there are three elements to it as listed below - Variables - for storing data Arguments - for passing data Expressions - for manipulating data. Let us first look at the variables. Variables are storage locations for data. Variables are declared before using them just like in any other languages like C# or VB.Net. Variables are defined with a specific scope. When you create a variable in an activity the scope of the variable becomes that activity's scope. Variables can also have access modifiers like None, Mapped or ReadOnly. Let us look at an example where we will create two variables and assign a scope to them along with access modifiers. //Declare a sequence activitiy Sequence seqWf = new Sequence(); //de...

Workflow Foundation 4 - Part 2 - Executing workflows

In my introductory post I had focused on giving a brief overview of workflow foundation-4 highlighting what is new and how things have changed from 3.5 to 4. You can check this out here . This post will be a very simple one in which I am going to focus on how to execute workflows. Executing workflows is very simple in WF4. There are basically two approaches - Use WorkflowInvoker Use WorkflowApplication Using WorkflowInvoker is the simplest of the two approaches. Some of the disadvantages of this method are - You cannot persist the workflow instance You cannot unload or resume bookmarks You can execute the workflow synchronously or asynchronously both using WorkflowInvoker. To execute the workflow synchronously using the WorkflowInvoker you simply call its static method Invoke and pass the workflow object to it. Here is a simple example - Sequence seqWorkflow = new Sequence { Activities = { new WriteLine {Text = "Hello"}, new WriteLine {Text = "World using WorkflowInvoker...