'UnitConfig DI Containers. Referencing multiple instances
So I have an interface IState which, as part of that has a reference to the next State, so another IState. This creates a linked list type scenario. The issue I am having is setting this up in UnityConfig. The way I have currently got this working is using RegisterInstance like this (example only, not my actual code):
Container.RegisterInstance<IState>("LastState", new StateFirstState(null));
Container.RegisterInstance<IState>("SecondState", new StateSecondState(Container.Resolve<IState>("LastState")));
Container.RegisterInstance<IState>("FirstState", new StateFirstState(Container.Resolve<IState>("SecondState")));
The issue is that logging (using log4net) shows all my log message as coming from UnityConfig and not the actual class they are generated in.
I'm assuming there must be a way of doing something very similar but using RegisterType?? Many thanks
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
