Extending the Application Blocks

Retired Content

This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies.
This page may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

The Composite Web Software Factory Application Blocks can serve as the foundation for your Web client applications. You can take advantage of the extensibility points incorporated in each application block and extend the application block by supplying new providers. You can also modify the source code for the existing application blocks to incorporate new functionality. Finally, you can add new application blocks to the software factory.

Guidelines for Extensibility

Use these guidelines when you extend the software factory application blocks. You can extend an application block by adding new providers, modifying an application block's existing source code, or adding new application blocks.

Exposing Functionality

An application block should provide a public API to expose the application block's functionality. The interface of the API should be independent of the internal implementation. Developers should not be required to understand the application block design or implementation to make effective use of its out-of-the-box functionality. Whenever possible, the API should apply to common scenarios for specific functionality.

Extending and Customizing Application Blocks

The application blocks provide extensibility points that developers can use to tailor the application block to suit their needs. For example, the Composite Web Application Block lets you replace the core services with custom implementations.

You can extend an application block without modifying its source code. To accomplish this, you should use extensibility points, such as public base classes or interfaces. Developers can extend the base classes or implement the interfaces and then add their extensions to the application block by modifying the configuration file. With this approach, there is no need to modify or rebuild the application block. Developers interested in extending the application block should find that this approach is well-organized, comprehensible, and that it conforms to Microsoft patterns & practices guidance.

When defining the set of extensibility points, consider the effect on usability. A large number of extensibility points can make the application block complicated to use and difficult to configure.

Some developers might be interested in customizing the code, which means that they will modify the source code instead of using the extension points. To support this effort, the custom application block design should provide the following:

  • It should follow object-oriented design principles whenever practical.
  • It should use appropriate patterns.
  • It should efficiently use resources.
  • It should adhere to security principles (for example, it should not trust user input and it should apply the principle of least privilege).

Recommendations for Modifying an Application Block

When modifying the source code, follow these best practices:

  • Make sure that you understand how the application block works by reading the topic that describes the design of the application block.
  • Consider changing the application block's namespace if you significantly alter the code or if you want to use your customized version of the application block along with the original version. Note that changing the application block's namespace requires you to update the guidance package to incorporate the new namespace.
  • Use strong naming. A strong name allows the assembly to be uniquely identified, versioned, and checked for integrity. You will need to generate your own key pair to sign your modified version of the application block. For more information, see Strong-Named Assemblies. Alternatively, you can choose to not sign your custom version. This is referred to as weak naming.
  • You must recompile your code for your modifications to take effect. Open the application block's solution file and rebuild the entire solution.