Hello,
I have a MessageSender class that its constructor looks like this:
public MessageSender(IInputComponent input, IOutputComponent output)
{
m_Input = input;
m_Output = output;
}
This is how I instantiate it:
Container.RegisterType<IMessageSender, MessageSender>();
Container.RegisterType<IInputComponent, KeyboardInput>();
Container.RegisterType<IOutputComponent, ScreenOutput>();
Container.RegisterType<ILogger, Logger>();
return Container.Resolve<IMessageSender>();
Here is the KeyboardInput consutructor:
public KeyboardInput(IUnityContainer container)
{
m_Container = container;
m_Logger = container.Resolve<ILogger>();
}
I want the KeyboardInput instance to receive a child container to its constructor, so it will resolve its logger from the child container and not the parent.
How can I accomplish that?
Thanks!