I have the following scenario :
public interface IFoo { }
public interface IFoo3 { }
public class Foo4 : IFoo3 { }
public class Foo1 : IFoo { }
public class Foo2 : IFoo
{
Foo2 (IFoo object1, IFoo3 object2)
}
on the client side :
IUnityContainer container = new UnityContainer();
container.RegisterType<IFoo, Foo1>("Foo1");
container.RegisterType<IFoo3, Foo4>();
container.RegisterType<IFoo, Foo2>("Foo2");
IFoo3 obj = container.Resolve<IFoo3>(); //Resolve 1
IFoo obj2 = container.Resolve<IFoo>(); //Resolve 2
The resolve 2 (see comment ) gives an error that a constructor could not be found.
I basically want it to resolve to Foo2 class. I even tried using parameteroverrides but that did not work either.
Please help me on this.