You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 21, 2024. It is now read-only.
In some circumstances, the resolved objects might "need" to hold a reference to the IoC container itself, so they can use it later to resolve other objects during their lifetime, as if it was an injected factory.
Right now, this is only possible if we perform an explicit registration of the container itself, and this has the drawback of "fixing" its type for all possible future resolutions.
This forces us to register the container as late as possible, and could not be enough in case we need to use it from different registered dependencies, so we might have to register it many times with different keys. That's clearly suboptimal from a usability perspective.
Proposed solution:
Reserve the string $ to identify the container itself.
When used during resolution, the container itself has to be returned
It has to be impossible to register other dependencies using $ as key.
The type of the resolved value for the key $ changes every time we register a new dependency, to avoid having a "fixed" type that doesn't account for all the introduced changes in the container.
Problem description:
In some circumstances, the resolved objects might "need" to hold a reference to the IoC container itself, so they can use it later to resolve other objects during their lifetime, as if it was an injected factory.
Right now, this is only possible if we perform an explicit registration of the container itself, and this has the drawback of "fixing" its type for all possible future resolutions.
This forces us to register the container as late as possible, and could not be enough in case we need to use it from different registered dependencies, so we might have to register it many times with different keys. That's clearly suboptimal from a usability perspective.
Proposed solution:
$to identify the container itself.$as key.$changes every time we register a new dependency, to avoid having a "fixed" type that doesn't account for all the introduced changes in the container.Status