How can I pass arguments to a constructor in an IOC-framework? I want to do something like: (Trying to be IOC-framework agnostic 😉 )
object objectToLogFor = xxx; container.Resolve<ILogging>(objectToLogFor); public class MyLogging : ILogging { public MyLogging(object objectToLogFor){} }
It seems that this is not possible in StructureMap. But I would love to see someone prove me wrong.
Are other frameworks more feature-rich? Or am I using the IOC-framework in the wrong way?
In structure map you could achieve this using the With method:
See: http://codebetter.com/blogs/jeremy.miller/archive/2008/09/25/using-structuremap-2-5-to-inject-your-entity-objects-into-services.aspx