Note that there are some explanatory texts on larger screens.

plurals
  1. POConfiguring profiles with StructureMap
    primarykey
    data
    text
    <p><strong>important</strong>; I'm <em>really</em> looking for a <a href="http://structuremap.sourceforge.net/Default.htm" rel="noreferrer"><code>StructureMap</code></a> answer here. Please don't say how to do it with Windsor, Spring, Unity, or any of <a href="http://www.hanselman.com/blog/ListOfNETDependencyInjectionContainersIOC.aspx" rel="noreferrer">the others</a>.</p> <p>I'm playing with <code>StructureMap</code> for IoC - and basically my aim is to have a "default" profile that defines the core types, and a number of named profiles that override/extend this. I <em>think</em> that profiles can do this, but I simply can't get it to work either through the xml or the code APIs. In particular, if I try to load a container for a profile:</p> <pre><code>container = new Container(); container.SetDefaultsToProfile(profile); </code></pre> <p>Then I get "Requested Profile {name} cannot be found", despite the fact that I clearly called <code>CreateProfile</code> in the initialize (with that name).</p> <p>Am I barking up the wrong tree?</p> <p>(also posted to <a href="http://groups.google.com/group/structuremap-users/browse_thread/thread/a0f67ba586eb3bcd?hl=en" rel="noreferrer">user-group</a>)</p> <hr> <p>What I ideally want is to be able to define the <em>standard</em> (/default) types, and then for a range of different named configurations, override some of the settings - i.e. if I had</p> <ul> <li>global: <code>IFoo</code> => <code>Foo</code>, <code>IBar</code> => <code>Bar</code> </li> <li>configA: (no changes) </li> <li>configB: <code>IFoo</code> => <code>SpecialFoo</code> </li> </ul> <p>I believe this could map to 2 containers, loaded using named profiles. The purpose being that if I ask either container for an <code>IBar</code>, I get a <code>Bar</code> - but configA returns a <code>Foo</code> (for <code>IFoo</code>), where-as configB returns a <code>SpecialFoo</code>. </p> <p>Can somebody give me a clue how I can configure this? Either xml or code is fine... I just want it to work. All I need is interface-to- concrete-type mappings (no special config/property settings). </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload