public interface A
{
}
public interface B
{
}
public interface C : A, B
{
}
public class Foo : C
{
}
IUnityContainer unity = new UnityContainer();
unity.RegisterType<A, Foo>(new TransientLifetimeManager(), new InjectionFactory(container => { throw new Exception(); }));
unity.RegisterType<B, Foo>(new TransientLifetimeManager(), new InjectionFactory(container => { throw new Exception(); }));
unity.Resolve<A>(); //uses RegisterType<B, Foo> InjectionFactory
我希望 Unity 使用“A”InjectionFactory。