Viewing the Effective Policies

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.

The latest Enterprise Library information can be found at the Enterprise Library site.

The policies that the Policy Application Block applies depend on a range of factors, including attributes declared on the target class and its members, and the combination of matching rules in all the policies defined in the application configuration. The result is that it is often difficult to see exactly which handlers the application block will apply to an individual class and class member.

To assist developers, administrators, and operators, the patterns & practices group provide a separate tool named Effective Policy Viewer that can analyze an assembly using a specified configuration file and discover the actual handler policy that will apply to the classes within the assembly (see Figure 1).

Ff648993.aadab04c-8628-4144-a57a-edd981853e35(en-us,PandP.10).png

Figure 1
Using the Effective Policy Viewer to view the policies that apply to a target class instance

The Effective Policy Viewer is not part of Enterprise Library, but it is available as an additional resource that you can download from the patterns & practices Enterprise Library Web site.

The tree view in the left pane shows all of the namespaces, classes, and members in the selected assembly. A class that appears disabled (grayed-out) indicates that none of the members has a policy applied to them. For items that are not disabled, you can expand the node to see which members of the class have policies applied. Selecting a class member shows the list of policies and handlers in the tree view in the right pane. The order that the handlers appear in the list reflects the order that they will execute at runtime.

Note

Policies will only be applied when your code creates or wraps objects using the methods of the PolicyInjection class or when using the Unity interception approach. However, the tool cannot verify that this is the case.