Workflows are created either by being defined in XAML Extensible Application Markup Language using the workflow designer, or by being assembled programmatically in a .NET language such as C# or . If the designer is used, activities are assembled on the workflow designer canvas by dragging them from the toolbox. Workflow arguments and variables are also created and assigned within the designer. If a workflow is assembled in code, activities are instantiated like other CLR objects, and assembled into collections of a single parent activity, usually a Sequence or Flowchart. The single parent activity is then executed using WorkflowApplication or WorkflowInvoker, and runs as a workflow. The term "Workflow" here usually refers to the root activity that is executed by the host. Workflows can use both out-of-box activities and custom activities. Out-of-box activities include flow control activities such as DoWhile, Flowchart-related activities such as FlowDecision, WCF Messaging activities such as Send, and primitive activities that perform simple tasks like Assign and WriteLine. Custom activities are user-created CLR objects that derive from the class , and provide declarative functionality by allowing the developer to define the execution behavior of the activity in code. Custom activities can benefit from having a custom activity designer associated with them to enhance the visual authoring experience in the Visual Studio IDE.
Take note that we have changed the Workflow1 initializer class to HelloLiza . For every new Workflow, we are actually creating a class. On the 5 th line we are creating an Activity object based on our Workflow. WorkflowInwoker is a simple class which its Invoke
method is used to invoke a Workflow. Why I said simple class because provides different methods to invoke a workflow. WorkflowInvoker is useful for synchronous execution of workflows. For long-running Workflows or Workflows which use PersistenceStores you need to use WorkflowApplication class.