Starting from Enterprise Library 5.0, Unity supports interception mechanisms which captures the call to an object at invocation time and provides the full implementation of the object through lightweight code generation (ILEmit). It’s something very similar to the aspect-oriented programming (AOP) approach.
However, Unity is NOT an AOP framework implementation for the following reasons:
- It uses interception to enable only preprocessing behaviors and post-processing behaviors.
- It does not insert code into methods, although it can create derived classes containing policy pipelines.
- It does not provide interception for class constructors.
Instance Interception VS Type Interception
With instance interception, when the application resolves the object through the container,
- The Unity interception container obtains a new or an existing instance of the object and creates a proxy.
- Then it creates the handler pipeline and connects it to the target object before returning a reference to the proxy.
- The client then calls methods…
View original post 980 more words