Runtime Behavior 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.

To understand how the application block passes client code calls to the target object at run time, you must visualize the dynamic behavior. Figure 1 illustrates how the InterceptingRealProxy invokes the first handler in the handler pipeline. Each handler invokes the next handler in the pipeline through a delegate named GetNextHandlerDelegate until the final handler in the pipeline invokes the method or accesses the property of the target object.

Ff649256.PI-DES-ProcessFlow(en-us,PandP.10).gif

Figure 1
The process flows through the handler pipeline for a method call to the target object

After the target method or property accessor completes, control passes back to the previous handler in the pipeline as the Invoke method calls unwind from the run-time stack. Finally, the InterceptingRealProxy passes the return value (if any) through the TransparentProxy to the client.

The remoting mechanism in the .NET Framework defines interfaces named IMessage and IMethodCallMessage that can hold details of the message passed along the remoting channel. However, the Policy Injection Application Block defines two specific interfaces for classes that implement invocation and return messages transmitted over the handler pipeline:

  • IMethodInvocation. This interface defines the structure of a message that passes the client call to the target object. It defines properties that expose the inputs and parameters of the call, the target object and target member (method or property), and the invocation context (a Dictionary). It also defines two methods that generate a message or an exception to return to the client.
  • IMethodReturn. This interface defines the structure of a message that passes back from the target object to the client and contains the result of the property access or method invocation. It defines a property that exposes the output parameters, read/write properties that expose the return value and any exception for return to the client, and the invocation context (a Dictionary).

Each handler can examine and modify the values in the messages, although they must not attempt to modify the method or property accessor signature because this will generally result in remoting failures and hard to find bugs in the handler code.

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.
Show: