Interface for the root-most target container, which typically 'owns' all the top-level registrations required by an application.
This builds on the ITargetContainer interface by adding the ICovariantTypeIndex interface too, as well as events which allow an application to listen for target and target container registrations within the root.
public interface IRootTargetContainer : ITargetContainer, ICovariantTypeIndex
Note - the container is not automatically registered - it can be registered with a call to this instance's RegisterContainer(Type, ITargetContainer) implementation.
ITargetContainer CreateTargetContainer(Type forContainerRegistrationType)
Gets the type under which the ITargetContainer that will 'own' registrations
for the given
serviceType will be registered in this root container.
Type GetContainerRegistrationType(Type serviceType)
Use of this API is exclusive to code that is extending Rezolver.
All targets that are registered in an IRootTargetContainer are ultimately stored inside another ITargetContainer that will be registered with the RegisterContainer(Type, ITargetContainer) API and retrieved with the FetchContainer(Type) methods. When registering targets, both this method and the CreateTargetContainer(Type) methods are used to ensure that the correct ITargetContainer is created to hold a given target.
This method is specifically used to identify the type that should be used to fetch a target container (or indeed register it) for a given service type. Most of the time, the two types are the same; however, there are special cases where they're not.
For example, in the standard implementation of this interface (TargetContainer), if you pass a generic type to this method, it will return the definition of that generic type - which then allows the GenericTargetContainer class to ultimately 'own' all the registrations against all generic types - open or closed.
Therefore, the system uses this method both to locate existing target containers and when auto-creating and registering new target containers to hold new registrations.
Raised when a child target container (e.g. a DecoratingTargetContainer) is registered in this root container, or when any container is automatically created and registered in this root container.
event EventHandler<TargetContainerRegisteredEventArgs> TargetContainerRegistered
Please note - this event is only guaranteed to fire for target containers that are directly registered through this instance.
Raised when a target has been registered in this root container (possibly as a child within a target container that was previously registered).
event EventHandler<TargetRegisteredEventArgs> TargetRegistered
Please note - this event is only guaranteed to fire for targets that are directly registered through this instance.