var container = new Container(x =>
{
x.For<IEngine>().Use<V6Engine>();
x.For<ICar>().Use<HondaCar>();
}
);
ICar car = ObjectFactory.GetInstance<ICar>();
Console.WriteLine(car.Noise());
I am getting the error:
StructureMap Exception Code: 202
No Default Instance defined for PluginFamily ClassLibrary1.ICar, ClassLibrary1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
I read the quickstart, and I understood that if you wireup a particular interface that is also used in a constructor, you don’t have to explicitly wireup the interface in each classes constructure.
So in the above, I wired up IEngine to V6Engine, and then ICar to HondaCar (that has a constructor that has an IEngine that I have already wired up).
Why does this not work?
try :
Hope it helps.