A workflow is essentially a way of documenting the activities involved in completing a unit of work. Typically, work “flows” through one or more activities during processing. These activities can be performed by either machines or by people, and can be as simple as defining the sequence of pages in an Internet application, or as complex as managing documents or products that must be seen, altered, and approved by any number of people.
You can host Windows WF workflows in any type of .NET application, including Windows Forms, console applications, Windows Services, and ASP.NET Web applications. Each type requires special considerations. While examples that showcase hosting workflows in Windows Forms and console applications are already plentiful, this article focuses on issues facing ASP.NET developers who wish to integrate workflow into their applications.
Steps to Develop Sample ASP.NET WorkFlow
- Add New Project of type workflow in your solution
- Right Click on created project , From add > Sequential WorkFlow
- Open WorkFlow, Drag Code from toolbox to diagram. and double click on code and write code for that part
- Add new Web Project to the solution
- write code below on some event
using (WorkflowRuntime wr = new WorkflowRuntime())
{
AutoResetEvent are = new AutoResetEvent(false);
wr.StartRuntime();
Dictionary parameters = new Dictionary();
parameters.Add("A", int.Parse(txtA.Text));
parameters.Add("B", int.Parse(txtB.Text));
wr.WorkflowCompleted += delegate(object WFsender, WorkflowCompletedEventArgs ee)
{
lblMessage.Text = ee.OutputParameters["Result"].ToString();
are.Set();
};
wr.CreateWorkflow(typeof(WorkFlowLib.MyWorkFlow), parameters).Start();
are.WaitOne();
}
Download: WorkFlowTraining