This project is read-only.

Unity Bridge

 Assembly  EnterpriseLibraryExtensions.PolicyInjection.UnityBridge.dll 
Namespace  EnterpriseLibraryExtensions.PolicyInjection.UnityBridge
 Class  UnityPolicyExtension

The Unity Bridge enables an application to resolve instances through Unity that are automatically policy injected if they are so declared in either configuration or by attributes. This is archived by adding an additional step to the Unity resolving pipeline.

To enable this functionality, the extension must be registered on the Unity container used to resolve the dependency. This can be done either in code or by configuration.

In Code

To create a completely new container that is ready for policy injection, there is a static helper method available on the UnityPolicyExtension class called CreateUnityContainer.

var container = UnityPolicyExtension.CreateUnityContainer();

If the application already has an instance of a Unity container present, the extension can be registered by calling:


By Configuration

To add the Policy Injection Bridge into a Unity Container through configuration, the following extension must be added to the right container’s list of extensions:

  <add type=
    EnterpriseLibraryExtensions.PolicyInjection.UnityBridge" />

Quick Starts

To see code samples on how to do the above, navigate to the “Quick Starts” folder where the source code has been installed.

Last edited Apr 18, 2012 at 8:17 PM by RasmusTherkelsen, version 11


No comments yet.