







Microsoft Enterprise Library 5.0 |
Extending and Modifying Unity |
![]() ![]() |
If required, you can extend and modify Unity to better suit your own requirements. You can extend Unity by doing the following:
- Creating Lifetime Managers that control how and when the container will dispose of instances of objects it resolves.
- Creating and Using Container Extensions that can change the behavior of the container, the instance generation mechanism, and the dependency injection and interception features.
- Creating Policy Injection Matching Rules that provides alternative techniques for selecting classes and class members to which Unity will attach a handler pipeline.
- Creating Interception Policy Injection Call Handlers that perform the task-specific processing you require for method invocations and property accessors.
- Creating Interception Handler Attributes that cause Unity to add built-in or custom call handlers to the handler pipeline. If you create a custom handler, you may also want to create a custom attribute that developers can use to apply your handler by adding the attribute directly to classes or class members within the source code of an application.
- Creating Interception Behaviors that describe what to do when an object is intercepted.