title: Decorator pattern and structuremap with multiple decorators
body: <p>I am trying to wire up a series of decorators using structure map but am having some issues.</p>
  
  <p>I have read <a href="https://stackoverflow.com/questions/1443464/structuremap-and-the-decorator-pattern">this question</a> which got me to the point where i can have a single decorated class, but i can't seem to get multiple levels of decorator working.  What i have is class A which takes a connection string as a parameter, and then class B and class C which are both decorators for class A.  I can get structuremap to create B which wraps A but I cant seem to get C wrapping B wrapping A.</p>
  
  <p>This works for 1 level:</p>
  
  <pre><code>For&lt;IQuestionRepository&gt; ()
                  .Use&lt;LinqToSqlQuestionRepository&gt; ()
                      .Ctor&lt;string&gt;("connectionString")
                      .Is(x=&gt;System.Configuration.ConfigurationManager.ConnectionStrings["aspnetdbConnectionString"].ConnectionString)
                  .EnrichWith (x=&gt;new RecentQuestionCachedRepository(x))
  </code></pre>
  
  <p>and I thought that just adding another EnrichWith would work like so:</p>
  
  <pre><code>For&lt;IQuestionRepository&gt; ()
                  .Use&lt;LinqToSqlQuestionRepository&gt; ()
                      .Ctor&lt;string&gt;("connectionString")
                      .Is(x=&gt;System.Configuration.ConfigurationManager.ConnectionStrings["aspnetdbConnectionString"].ConnectionString)
                  .EnrichWith (x=&gt;new RecentQuestionCachedRepository(x))
                  .EnrichWith (y=&gt;new FeaturedQuestionCachedRepository(y));
  </code></pre>
  
  <p>but this just gives me a FeaturedQuestionCachedRepository which wraps a LinqToSqlQuestionRepository but the RecentQuestionCachedRepository is not anywhere in the  stack.</p>
  
  <p>What am I doing wrong?</p>