There is an unsaved comment in progress. You will lose your changes if you continue. Are you sure you want to reopen the work item?
How to inject child container to injected classes.
What is the right way to inject the per request child container to an injected member?
I have a class that discovers, registers, and resolves classes at runtime with Unity. I register the dependencies for these classes with the container passed to UnityDependencyResolver.
I also register the class that does the discovering with the original container and use an InjectionConstructor to inject that container into the class.
The issue comes with types registered with a HierarchicalLifetimeManager, for example my repository. Because my class has the parent container and the controller is resolved with a child container, I am getting multiple instances of my repository.
How can I solve this issue?