Search code examples
structuremapstructuremap3

What happened to constructor argument injection when getting instances of objects in StructureMap's ObjectFactory?


Trying to upgrade/convert to StructureMap 3.0 from 2.6

I have code that manually set constructor arguments via the With method off of the ObjectFactory

ObjectFactory.With(ctorArgument).GetInstance<ClassThatHasACtorArgument>();

What is the StructureMap 3.0 equivalent now?


Solution

  • Doh... it was moved into the global container...

    ObjectFactory.Container.With(ctorArgument).GetInstance<ClassThatHasACtorArgument>();