Types of Workflows and selecting the best one
WorkFlow Foundation (WF) is a .NET 3.0 technology for managing workflows. Workflow can be thought of as a series of task that needs to be completed either sequentially or parrallely, completing one activity at a time in a pipeline
.NET Workflow are of two types:
1. State Machine Workflow
2. Sequential Worflow
The good question is: how to decide which one suits your need?
Let’s decide:
1. State Machine has states, states can be thought of as a land mark in a long running activity. You reach one
land mark, rest there, move to next and so on. Take for example Performance Appraisal at the end of the year.
The states can be represented as:
1. Employee Completed Self Appraisal
2. Manager Completed Employee Appraisal
3. Reivew Completed between Employee and Manager
4. Ratings Finalized
Now you move in order, you complete the state 1 then 2 and so on and each of these states mark your status in the whole process.
Workflow also can persist your states in database, so it doesn’t matter how long it takes for them to complete.
So if you are working on an activity which needs human interventions (for approvals) you should go for State Machine Workflows. It can also take care of load on the server due to multiple workflows starting at the same time.
2. Sequential Workflow can process activities in sequence but at the same time they can also spawn multiple thread on a part of the activity by using the Parallel Activity component. Use Sequential Workflows if you are not very much well verse with multiple thread management, but still want to use its features to enhance the performance of your application.


