Export (0) Print
Expand All

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.
To create client business applications using current Microsoft technologies, see patterns & practices' Prism.

The Smart Client Software Factory Application Blocks can serve as the foundation for your smart client applications. You can take advantage of the extensibility points incorporated in each application block. 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 using extensibility points, 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-box functionality. Whenever possible, the API should apply to common scenarios for a 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. The most common use of extensibility points is to allow developers to use their own components to customize the block’s behavior. For example, the Connection Monitor Application Block allows users to build their own implementations of the Connection base class to monitor a specific connection type not included out-of-the-box.

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 it 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 may 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 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, distrust of user input and principle of least privilege).

Recommendations for Modifying an Application Block

When modifying the source code, follow these recommended practices:

  • Make sure 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.



Show:
© 2014 Microsoft