Getting Started with the Web Client Software Factory 2010
Are you new to the Web Client Software Factory? After installing the Web Client Software Factory, the best way to get familiar with the Web Client Software Factory is to do the following:
Just Want to Review the Documentation?
If you are in the evaluation phase of the software factory, you can download the documentation
before downloading the software factory. Then, when you are ready, you can download the software factory.
Understanding the Basic Steps
Figure 1 illustrates the steps involved in creating the Hello World application.Figure 1Create Web client solution
These steps are explained in more detail in the following procedure.To perform the basic steps
- Create the Web client solution. To do this, create the project and set some of its properties, such as where the default Web page is located.
- Set the startup project, and then compile and run initial solution.
- Add a Hello World business module. A business module encapsulates an aspect of your application’s functionality.
- Create a page in the Hello World business module. Business modules typically contain related Web pages. The page has a presenter. The presenter contains the logic that implements the behavior of the UI.
- Register the page with the site map. This creates a parent and a child node.
- Compile and run the solution.The next section describes how to use the Web Client Software Factory recipes to create the Hello World application.
Create Your Hello World Application
This section describes how to use the Web Client Software Factory recipes. To create your first Hello World application, perform the procedures in this section.
Note: The following procedures require that the Web Client Software Factory guidance package be installed.
Figure 2Create Web client solutionTo create the Web client solution
- On the File menu, point to New, and then click Project. The New Project dialog box appears. This is shown in Figure 2.
- Under Project types, expand Guidance Packages, and then click Web Client Software Factory 2010.
- Under Templates, click Web Client Solution (C#, WebSite).
- In the Name box, type HelloWorldApplication.
- If you do not want to use the default location, enter one in the Location text box, and then click OK.
- On the first page of the Create Web Client Solution recipe wizard, confirm (or enter if necessary) the location of the required application block assemblies. This is shown in Figure 3.
- In the Root namespace box, type HelloWorld.
- Click Finish to unfold the Web Client solution template.
Figure 3: Create Web client solutionFigure 3Create Web client solution recipe wizardTo set the startup project, and then compile and run initial solution
Figure 4Hello World Web client applicationTo add a HelloWorld business module
- Set HelloWorldApplication as the startup project. To do this, right-click HelloWorldApplication in Solution Explorer, and then click Set as StartUp Project.
- Set the Default.aspx page in the root of the HelloWorldApplication site as the start page. To do this, right-click Default.aspx in the root of the Web site, and then click Set as Start Page.
- Press F5 to build and run the solution. You should see the default view created by the recipe on the right and a site map node named Home added by the Shell module on the left. Figure 4 shows the initial application running.
Figure 5Add new project dialog box
- In the Modules solution folder, create a solution folder (not a physical folder) named HelloWorld.
- Use the guidance package to create a new business module in the HelloWorld solution folder. To do this, right-click the HelloWorld solution folder in Solution Explorer, point to Web Client Factory, and then click Add Business Module (C#).
- In the Add New Project dialog box, type HelloWorld in the Name box. This is shown in Figure 5.
Figure 6Add Business Module recipe wizard
- In the Location box, click Browse to select %SolutionPath%\HelloWorldApplication\Modules\HelloWorld (create the HelloWorld folder if necessary).
- Click OK to create the project and launch the recipe wizard.
- The Add Business Module recipe wizard appears. Select the Click Finish*. This is shown in Figure 6.
Note: For more information about how to create a module in your solution, see “How To: Create a Business Module” in the Web Client Software Factory documentation.
To create a page in the HelloWorld module
Figure 7Add Page (with presenter) recipe wizard
- Create a new page named HelloWorldPage. To do this, right-click the HelloWorld folder inside HelloWorldApplication site, point to Web Client Factory, and then click Add Page (with presenter) (C#). The recipe wizard appears. This is shown in Figure 7.
- In the Page name box, type HelloWorldPage, and then click Finish. The Add Page (with presenter) recipe will add the IHelloWorldPageView interface and the HelloWorldPagePresenter class into Views folder inside HelloWorld project and the HelloWorldPage page into HelloWorld folder inside the HelloWorldApplication site.
Note: For more information about how to create a page in your module, see “How to: Add a Page with a Presenter” in the Web Client Software Factory documentation.
- Open the HelloWorldPage.aspx file, and then change the message “HelloWorldPage” to “Hello World!” The source code of the page must look like the following.
<%@ Page Language="C#" AutoEventWireup="true"
To register the page with the site map
- In Solution Explorer, double-click in the HelloWorldModuleInitializer.cs file located in the root of HelloWorld project inside the HelloWorld solution folder.
- In the RegisterSiteMapInformation method, add the site map node corresponding to the HelloWorldPage page, as shown in the following code.
protected virtual void RegisterSiteMapInformation(ISiteMapBuilderService siteMapBuilderService)
SiteMapNodeInfo moduleNode = new SiteMapNodeInfo("HelloWorld", "~/HelloWorld/Default.aspx", "HelloWorld");
SiteMapNodeInfo moduleNode1 = new SiteMapNodeInfo("HelloWorldPage", "~/HelloWorld/HelloWorldPage.aspx", "Hello World Page");
To compile and run the application
Figure 8Site map nodes added by the Hello World module
- Press F5 to build and run the solution. You should see two site map nodes added by the HelloWorld module (the parent and the child). This is shown in Figure 8.
Figure 9Hello World page
- Click in the Hello World Page child node. You should see the page added by the Add Page (with presenter) recipe. Figure 9 shows the HelloWorldPage.aspx page.
After you create your Hello World application, you can use the Web Client Software Factory How-to topics in the documentation to extend your application. The Hello World application can help you to do the following:
- Create a Web client solution.
- Enable a Web site to Use ASP.NET AJAX extensions.
- Create a business module.
- Create a foundational module.
- Add a page with a presenter.
- Add a master page with a presenter.
- Add a user control with a presenter.
- Implement the Model-View-Presenter pattern.
- Unit test a presenter.
- Register and use services.
- Add module pages to the site map.
- Use a module controller from a presenter.
- Use session state with unit testing.
- Map types for dependency injection.
- Authorize Web pages.
- Use the ObjectContainerDataSource control.
- Use the ServerSideValidationExtender control.
- Use the RealTimeSearchMonitor extender.
- Use the ContextSensitiveAutoCompleteExtender control.
For information about how to perform these activities, see the "Development Activities" topic in the documentation.
Building and running the Reference Implementations and QuickStarts
This section assumes the Web Client Software Factory Source Code has been installed.
Some solutions require the Ajax Control Toolkit
assembly that targets the .NET Framework 3.5 (downloaded separately). These solutions were tested on Version 11119
of the toolkit. The solutions that require Ajax Control Toolkit are:
- Order Management Reference Implementation
- Validation QuickStart
- AutoComplete QuickStart
Note: In order to build these solutions, first copy the Ajax Control Toolkit assembly to the *Lib\AjaxControlToolkit3.5* folder.
- Open the desired Reference Implementation or QuickStart solution file.
- Press F5 to build and run the application.
For access to other documentation and resources, or to provide feedback, see the Web Client Software Factory
Web site. For more general information about the goals of this and other patterns & practices deliverables, see the Microsoft patterns & practices Development Center