Accessing Properties and Calling Methods of the Target Class
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.|
After creating or wrapping the target class instance, client code can get or set the properties and call the methods of the target class through the proxy returned by the Create or Wrap method, as shown in the following code.
theTarget.SomeValue = 42; string returnValue = theTarget.DoSomething(parameter1, parameter2);
'Usage theTarget.SomeValue = 42 Dim returnValue As String = theTarget.DoSomething(parameter1, parameter2)
If the configuration of the Policy Injection Application Block contains matching rules and handlers for this member (property or method), or if it carries the appropriate attribute, the property accessor or method call passes along the pipeline executing the configured handlers. The Policy Injection Application Block does the following:
- It executes all the handlers configured in the handler pipeline in the order that they appear in the configuration or the order specified by for the Order property of each one, unless one of the handlers aborts the process (and perhaps raises an exception). Some handlers, such as those that perform validation or authorization, perform most or all of their processing at this stage.
- It invokes the target class method specified by the client code, or it reads or sets the specified property.
- It executes all the handlers configured in the handler pipeline in the reverse order that they appear in the configuration or the reverse of the order specified by for the Order property of each one. Some handlers, such as those that handle exceptions, carry out most or all of their processing at this stage.
Some handlers may perform their processing both before and after the target method or property invocation (in both the pre-processing stage and the post-processing stage). An example is the CachingHandler. Some handlers may also be configurable so that you can specify pre-processing operation, post-processing operation, or both. An example is the LoggingHandler.
In addition to using the built-in handlers, developers can create their own custom handlers for use within the handler pipeline. For information about creating custom handlers, see Extending and Modifying the Policy Injection Application Block.