structuremap configuration change based on settings in app.config

Posted by user74825 on Stack Overflow See other posts from Stack Overflow or by user74825
Published on 2010-04-26T01:01:28Z Indexed on 2010/04/26 1:03 UTC
Read the original article Hit count: 397

Filed under:
|
|

I am using structuremap in my project. To inject different implementation of a repository, I want to have a switch in app.config which changes all real implementation of a repository to a mock repositories.

Lets say IRepository has two implementations RealRepository and MockRepository

ForRequestedType() .TheDefaultIsConcreteType();

I want to have a switch in app.config / web.config say (Mock=1), which changes all real repositories implementation to

ForRequestedType() .TheDefaultIsConcreteType();

I don't want to write whole plugin definition in app.config, just want one switch, how do I implement this?

© Stack Overflow or respective owner

Related posts about structuremap

Related posts about ioc-container