Jaa


Providers

A provider in the Microsoft.NET Framework is an intermediary piece of code; with it, your application can connect to a service or data source and then retrieve or modify an object or data from that service or source. The Enterprise Library includes many providers. In addition, you can create your own provider to supply information that you need for your specific application.

A provider type defines an interface that is associated with a capability an application block must have to perform correctly. A provider is a specific implementation of a provider type. Each application block includes one or more providers for each provider type. You can also write custom providers for application blocks. Separating the application block's functionality from specific implementations of its capabilities achieves the following goals:

  • Variability. This allows you to choose from multiple implementations of the same capability, according to the requirements of a specific application.
  • Extensibility. This allows you to use the application block in environments where the capability in question has a mandatory implementation. For example, an application can require a specific encryption algorithm when deployed to a particular environment.
  • Encapsulation. This allows you to react to changes in the environment in which the application block is used. With providers, functionality that is not a part of the application block's core functionality can be replaced or upgraded without affecting other areas of the application block.
  • Portability across environments. This allows you to deploy the application block in a new environment with providers specific to that environment. You can also create providers that run in one environment and simulate behavior from a different environment.
  • Minimized coupling between application blocks. Application blocks that are dependent on other application blocks can encapsulate this dependency in a provider. This means that the application block is less vulnerable to revisions in the application block on which it depends. For example, the Exception Handling Application Block includes the logging exception handler. This handler is dependent on the Logging Application Block and is included as a provider. A new version of the Logging Application Block would require only a new logging handler provider; the rest of the Exception Handling Application Block can remain unchanged.

For information about creating your own providers for the application blocks, see the "Extending and Modifying" section of the documentation for each application block.