I made my configuration as follows:
var container = new Container(x => { x.For<IEngine>().Use<V6Engine>(); x.For<ICar>().Use<HondaCar>(); } );
Then in my mvc controller action I did:
ICar car = ObjectFactory.GetInstance<ICar>();
Should I somehow customize the container using Container or ObjectFactory? It was not resolving, so I tested things in a C # console application, and it worked if I did:
ICar car = container.GetInstance<ICar>();
But this only works if the container is in the local area, and obviously not the case in the web application, since things are connected in global.asax.cs
source share