StructureMap cannot automatically resolve primitive data types.
If you know the value at registration time you can use this syntax
ObjectFactory.Initialize(x =>
{
x.For<ICommand>()
.Use<SomeCommand>()
.Ctor<string>("path")
.Is("");
});
If you're using an appSetting
ObjectFactory.Initialize(x =>
{
x.For<ICommand>()
.Use<SomeCommand>()
.Ctor<string>("path")
.EqualToAppSetting("key");
});
However, if you want a different path
value for each instance of ICommand
then StructureMap cannot create these instances for you. You could, for example, define a ICommandBuilder
abstraction for creating instances of ICommand
or make Path
a settable property.