I the following chain of dependencies:
Handler() [depends on]
So, I have an IHandler, which depends on the IRepository, which in turn requires a connection string. The connection string is dynamic and passed at runtime (therefore, it cannot be read from the configuration file, etc.)
Imagine that the system creates a handler with the following code:
var handler = ObjectFactory.GetInstance<IHandler>();
This fails because the Repository (connectionString) dependency cannot be satisfied. My next idea was to use StructureMap ExplicitArguments to provide arguments at the beginning of building a dependency chain, i.e.:
var arguments = new ExplicitArguments();
arguments.SetArg("connectionString", "SOME CONNECTION STRING");
var handler = ObjectFactory.GetInstance<IHandler>(arguments);
, StructureMap connectionString ( , ).
: , StructureMap , connectionString?