WF from Getting Started to proficient (chapter I): WF Introduction

Source: Internet
Author: User
Tags zip visual studio

After completing this chapter, you will learn:

1. Understanding the concept and theory of workflow

2. Compare WF and BizTalk with WCF

3. Start using WF for programming

4. Know how to use Visual Studio Workflow support. Here is a small section of code to verify the ZIP code

string USCode = @"^(\d{5}$)|(\d{5}$\-\d{4}$)";
string CanadianCode = @"[ABCEGHJKLMNPRSTVXY]\D[A-Z]\d[A-Z]\d";
public static bool ValidatePostalCode(string str)
{
return (Regex.IsMatch(str,USCode)||Regex.IsMatch(str,CanadianCode));
}

This is nothing special: "Test a string of input, return True if it is a US zip code or Canadian zip code, or false". This is a very useful piece of code, in fact, if you do not want to use other validation controls in ASP.net, you can use this validation logic in your asp.net. We are now creating an workflow application that will perform the same validation and return information that validates whether it passed.

Create a workflow project based on the console

1. Start Visual Studio 2008

2. Create sequential Workflow Console Application project

3. Enter Pcodeflow in Project name

4. Click OK, will automatically generate the following initial interface

Before you edit the code or insert the workflow item, pause for a moment to see the two files generated by the workflow project:

Program.cs: This is a typical console application source file, as you can see in many ways. However, this template adds a lot of code to support workflow operations. Understanding the code is one of the main goals of the book, but this chapter simply understands what it does.

Workflow1.cs: This is a workflow component, we will modify it to verify the ZIP code, the first time you can put a lot of things, but now we still use this simple workflow start work.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.