10/14/2012

Hello Workflow


Workflows are a way to execute a business process. Each step in that process is implemented by an ActivityWe will create a very simple workflow that will be the equivalent to this code:
C#
private static void SayHello()
{
  Console.WriteLine("Hello Workflow 4");
}

Visual Basic
Private Shared Sub SayHello()
  Console.WriteLine("Hello Workflow 4")
End Sub
  1. Start Microsoft Visual Studio 2010 from Start | All Programs | Microsoft Visual Studio 2010.
  2. Create a new project in Visual Studio 2010 of type Workflow Console Application (under the Workflow project type) in either the Visual C# or Visual Basic projects Templates list. Ensure .NET Framework 4 is selected as the target runtime, and name it HelloWorkflow. Name the solution Begin, set the desired location, and click OK.
    Creating a new Workflow Console Application (C#)
    Creating a new Workflow Console Application (C#)
      Creating a new Workflow Console Application (Visual Basic)
      Creating a new Workflow Console Application (Visual Basic)
      1. Since our business process is a 1 step process, you can simply add a WriteLine activity to implement the process. From the Toolbox open Primitives tab, drag a WriteLine activity and drop it on the design surface.
        Adding a WriteLine activity
        Adding a WriteLine activity
        Note: If the Toolbox window is not visible, select Toolbox from the View menu.
        1. Set the WriteLine Text property to "Hello Workflow 4".
          Setting the Text property
          Setting the Text property
              WriteLine Activity
            The WriteLine activity is a simple activity that will display a message on the console. The text property is an Expression which could be the result of calling a function or evaluating the property of an object. In this case, the expression is a literal string so you must quote the string. Press CTRL+F5 to build and run the workflow without debugging. The application should run in a console window and print the message “Hello Workflow 4”.
          1. Press CTRL+F5 to build and run the workflow without debugging. The application should run in a console window and print the message “Hello Workflow 4”.
            The completed HelloWorkflow application
            The completed HelloWorkflow application

            No comments:

            Post a Comment