Using LogManager.GetLogger with Unity
问题 Given this class: class Foo { readonly ILog log; public Foo(ILog log) { this.log = log; } ... } I'd like to configure Unity to inject ILog. That's easy: container.RegisterInstance<ILog>(LogManager.GetLogger(typeof(XYZ))); But I'd like to make Unity call LogManager.GetLogger with the type of the parent type being resolved. This is close: container.RegisterType<ILog>(new InjectionFactory((c, t, s) => LogManager.GetLogger(t))); But t in this case is the type being resolved ( ILog ), not the type