I know that in StructureMap I can read from my *.config files (or files referenced by them), when I want to pass specific arguments to an object's constructor.
ForRequestedType<IConfiguration>()
.TheDefault.Is.OfConcreteType<SqlServerConfiguration>()
.WithCtorArg("db_server_address")
.EqualToAppSetting("data.db_server_address")
But what I would like to do is read from one config setting in debug mode and another in release mode.
Sure I could surround the .EqualToAppSetting("data.db_server_address")
, with #if DEBUG
, but for some reason those statements make me cringe a little when I put them in. I'd like to know if there was some way to do this with the StructureMap library itself.
So can I feed my objects different settings based on whether the project is built in debug or release mode?