The Policy Injection Application Block

The Policy Injection Application Block

Policy injection can be used to change the behavior of your custom objects, and almost any other .NET class, in order to better manage crosscutting concerns for these objects. In the current version of Microsoft® Enterprise Library, policy injection is implemented through the Unity interception mechanism. For more information see Interception with Unity.

While the Policy Injection Application Block is still included in this release of Enterprise Library, it is (with the exception of one call handler) a set of legacy components such as the PolicyInjection facade that supports backwards compatibility with applications that use versions of Enterprise Library prior to version 5.0.

For information about these legacy components, see the guidance for previous versions of Enterprise Library. This is available on the Microsoft Enterprise Library site on MSDN®, and includes specific information for Creating an Instance of an Interceptable Target Class, details on using the create method, details on using the wrap method, and Specifying a Configuration Instance When Creating and Wrapping Objects. You can, in addition, use the configuration tools provided with this release of Enterprise Library to configure policy injection if you decide to use the legacy approach.

Also be aware that, even if you decide to continue to use the backwards compatibility techniques included in the Policy Injection Application Block, you must still make some changes to your existing application. The location of all of the call handlers (with the exception of the Performance Counter Handler) has changed, so you must ensure that you reference the appropriate assemblies and namespaces in your code.

The five call handlers you can use, and their assemblies and namespaces are:

  • Authorization handler
    • Class name: AuthorizationCallHandler
    • Assembly: Microsoft.Practices.EnterpriseLibrary.Security.dll
    • Namespace: Microsoft.Practices.EnterpriseLibrary.Security.PolicyInjection
  • Exception handling handler
    • Class name: ExceptionCallHandler
    • Assembly: Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.dll
    • Namespace: Microsoft.Practices.EnterpriseLibrary.ExceptionHandling.PolicyInjection
  • Logging handler
    • Class name: LogCallHandler
    • Assembly: Microsoft.Practices.EnterpriseLibrary.Logging.dll
    • Namespace: Microsoft.Practices.EnterpriseLibrary.Logging.PolicyInjection
  • Validation handler
    • Class name: ValidationCallHandler
    • Assembly: Microsoft.Practices.EnterpriseLibrary.Validation.dll
    • Namespace: Microsoft.Practices.EnterpriseLibrary.Validation.PolicyInjection
  • Performance counter handler
    • Class name: PerformanceCounterCallHandler
    • Assembly: Microsoft.Practices.EnterpriseLibrary.PolicyInjection.dll
    • Namespace: Microsoft.Practices.EnterpriseLibrary.PolicyInjection.CallHandlers

The Caching handler is no longer included in Enterprise Library due to concerns around the issues of cache contamination and other limitations previously documented. If you require the Caching handler, you can download the previous version from the Enterprise Library community Web site at and integrate it with Enterprise Library.

More information about the changes to the Policy Injection Application Block can be found in the section Changes in This Release in the introduction to this guidance. Information about migrating existing applications to use the current version of Enterprise Library can be found in the Migration Guide available from the Enterprise Library community Web site at

© 2015 Microsoft