Share via


Class Hierarchy of the Policy Injection Application Block

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.

Figure 1 illustrates the interrelationships between the key classes in the Policy Injection Application Block. This diagram also shows the relative structure and hierarchy of the objects in the set of policies for the application block when code executes the Create or Wrap method of the PolicyInjection factory class.

Ff650276.f8ecf2c2-4376-4d87-8e0e-16b21b9a39fe(en-us,PandP.10).png

Figure 1
Class diagram of the Policy Injection Application Block

The Policy Injection Application Block uses .NET Framework remoting technology to perform interception and allow policies to insert handler pipelines between the client call to a method or property and the actual target object method or property. Remoting an object requires the .NET Framework to create two proxies between the client and the target object.

The first of these proxies is an instance of the __TransparentProxy class (from the System.Runtime.Remoting.Proxies namespace), which deceives all the common language runtime (CLR) code that performs casting, field access, method dispatch, and so on, into thinking that it is dealing with a local instance of the appropriate type. The second of the proxies is an instance of a class that inherits from the RealProxy class (also in the System.Runtime.Remoting.Proxies namespace). This class provides an extensibility point where you can define your own proxy to perform communication across the chosen channel to the target object.

In the Policy Injection Application Block, InterceptingRealProxy is the concrete class that inherits from the RealProxy class. The InterceptingRealProxy instance generates the handler pipeline and invokes the first handler in response to calls from the client code arriving through the TransparentProxy.

Figure 1 also shows the hierarchy of objects that implement the set of policies for the Policy Injection Application Block. The InterceptingRealProxy instance uses these to select the appropriate classes and members for which interception will apply to generate the handler pipeline for matching class members. The RuleDrivenPolicy instance holds information about the matching rules and handlers for a policy defined in the application configuration. The AttributeDrivenPolicy instance holds information about the set of handlers applied to target object classes and class members through directly applied attributes, for which there is no information in the application configuration.

For a description of the interfaces and requirements for custom matching rules and handlers, see Extending and Modifying the Policy Injection Application Block.