共用方式為


Dependencies in Enterprise Library

This topic describes the dependencies between the blocks and on the core features of Enterprise Library. It contains the following sections that describe the inter-block dependencies for common scenarios:

  • Dependencies for All Application Blocks
  • Block Dependency Schematic
  • Additional Dependencies for the Caching Application Block
  • Additional Dependencies for the Exception Handling Application Block
  • Additional Dependencies for the Policy Injection Application Block
  • Additional Dependencies for the Security Application Block

Dependencies for All Application Blocks

All of the application blocks depend on other code included in the Enterprise Library:

  • The Unity dependency injection mechanism. Unity performs all the repetitive and necessary tasks for creating and disposing of object instances, while still providing a high level of flexibility. The Unity mechanism is contained in the assemblies Microsoft.Practices.Unity.dll and Microsoft.Practices.Unity.Interception.dll.

  • The service location assembly for the dependency injection mechanism. This assembly integrates any suitable dependency injection container with Enterprise Library by providing an abstraction layer for dependency injection. It is contained in the assembly Microsoft.Practices.ServiceLocation.dll.

  • Core library functionality. The Enterprise Library core provides services such as instrumentation and configuration, and it is a shared dependency of all Enterprise Library application blocks except for Unity. The core library functionality is contained in the assembly Microsoft.Practices.EnterpriseLibrary.Common.dll.

    Note

    You can use Unity as a stand-alone dependency injection mechanism. To support this feature, this application block contains its own configuration system. Therefore, you can use Unity without deploying the configuration system located in the Enterprise Library core.

Block Dependency Schematic

The following schematic shows the dependencies between each of the application blocks in Enterprise Library, and the Unity dependency injection mechanism. The following sections in this topic describe these dependencies in more detail.

Ff664422.ae74c556-28ff-48fa-a21b-f0d020eefdd4(en-us,PandP.50).png

Additional Dependencies for the Caching Application Block

The following are the additional dependencies when using the Caching Application Block:

  • If you use a database as a backing store, you require the Data Access Application Block.
  • If you want to encrypt data in the cache, you require the Cryptography Application Block.

Additional Dependencies for the Exception Handling Application Block

The following are the additional dependencies when using the Exception Handling Application Block:

  • If you use the Logging Application Block to log exceptions, you need Microsoft.Practices.EnterpriseLibrary.Logging.dll and Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.Logging.dll.
  • In addition, the Exception Handling Application Block might have dependencies on other code, including the Logging Application Block and the Data Access Application Block. The Exception Handling Application Block requires the Logging Application Block when it uses the logging handler. If you configure the Logging Application Block to use the database trace listener, it requires the Data Access Application Block. For more information, see The Logging Application Block and The Data Access Application Block.

Additional Dependencies for the Policy Injection Application Block

The following are the additional dependencies when using the Policy Injection Application Block:

  • The policy injection handlers provided with Enterprise Library use features of the application blocks. Most of the handlers are located within their respective application block assemblies. However, if your code does not use these handlers, you do not have to deploy the application blocks on which they depend.
    • If you use the Authorization Handler, you require the Security Application Block.
    • If you use the Exception Handling Handler, you require the Exception Handling Application Block.
    • If you use the Logging Handler, you require the Logging Application Block.
    • If you use the Validation Handler, you require the Validation Application Block.

Additional Dependencies for the Security Application Block

The following is the additional dependency when using the Security Application Block:

  • The Caching Application Block. The Security Application Block uses the Caching Application Block to cache security information and then retrieve it when required. You can replace the Caching Application Block with your own caching provider. Depending on how you configure the Caching Application Block, you may also require the Data Access Application Block. For more information, see The Caching Application Block.