How to: Create a Foundational Module
This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies.
Foundational modules are units of development and deployment that encapsulate infrastructure services. They do not contain Web pages nor do they have a module composition container. An example of a foundational module could be a module that contains services, such as logging and authorization services.
This topic describes how to use the Add Foundational Module Template to generate a foundational module.
The Add Foundational Module recipe assumes that you have an existing Web client solution. For information about how to create a Web client solution, see How to: Create a Web Client Solution.
The Add Foundational Module recipe applies to the Visual Studio solution folder (typically, this is the Modules solution folder).
The following procedure describes how to use the recipe to create a foundational module.
To use the Add Functional Module recipe to create a foundational module
- In Solution Explorer, right-click a solution folder, point to Web Client Factory, and then click Add Foundational Module (C#) or Add Foundational Module (Visual Basic), as shown in Figure 1.
- (Optional) In the Add New Project dialog box, illustrated in Figure 2, change the name of the project in the Name box and the location of the project in the Location box.
- Click OK. The recipe starts the Add Foundational Module Wizard. Figure 3 illustrates the first page of the wizard.
- Under Web site in the left pane, click the Web site with a Web.config file that is to be used to define the module.
- (Optional) If you want to create a separate project that contains the public interface for the module, select the Create an interface library for this module check box. By using a separate project for the public interface of the module, you reduce the coupling between the business module and other modules in the application because modules reference the interface project instead of the module assembly.
- (Optional) If you want a test project for the module to be created with test classes for your module components, select the Create project for unit tests check box.
- Click Finish. The recipe generates the foundational module.
As illustrated in Figure 4, you will have the following elements in your solution:
- A C# class library project. This is the module class library. It contains a module initialization class and an empty folder named Services.
- (Optional) A class library project that contains the public interface. This is a project that you can use to define the public interface that you want to share with other modules.
- (Optional) A test project for the module. This is an empty project that you can use to create your unit tests.
- An updated Web.config file. The module definition will be added to the <modules> section of the Web.config file of the selected Web site. The Composite Web Application Block uses this information to load the module when the application starts.
After you run the Add Foundational Module recipe, you are ready to perform one of the following steps:
- Implement services. Services are components that provide application or infrastructure logic.
- Registers the services as global services. To register global services, you add them to the root composition container. For more information related to registering and using services, see How to: Register and Use Services.