Extending the container
The best usage of the container is one that requests the component, uses it and then calls ReleaseComponent so the container can invoke all decommission phases and do the proper clean up. We know that sometimes this is too much to ask, so the MicroKernel has a pluggable release policy that can hook up and implement some routing to dispose the components.
The MicroKernel comes with three IReleasePolicy implementations:
- AllComponentsReleasePolicy: track all components to enforce correct disposal upon the MicroKernel instance disposal
- LifecycledComponentsReleasePolicy: only track components that have a decommission lifecycle associated
- NoTrackingReleasePolicy: does not perform any tracking
You can also implement your own release policy by using the interface IReleasePolicy.