title: Decorators with different constructor arguments
body: <p>Using Castle Windsor, I'd like to create a class that records an integer.  But I'd like to decorate it several times with other classes.  I can see how this works if all concretes involved have dependencies that can be resolved, but that's not the case here.  Consider this code:</p>
  
  <pre><code>public interface IRecorder
  {
      void Add(int value);
  }
  
  public class NotifyingRecorder : IRecorder
  {
      readonly IRecorder decoratedRecorder;
  
      public NotifyingRecorder(IRecorder decoratedRecorder)
      {
          this.decoratedRecorder = decoratedRecorder;
      }
  
      public void Add(int value)
      {
          decoratedRecorder.Add(value);
          System.Console.WriteLine("Added " + value);
      }
  }
  
  public class ModelUpdatingRecorder : IRecorder
  {
      int seed;
  
      public ModelUpdatingRecorder(int seed)
      {
          this.seed = seed;
      }
  
      public void Add(int value)
      {
          seed += value;
      }
  }
  </code></pre>
  
  <p>And registered with:</p>
  
  <pre><code>container.Register(Component.For&lt;IRecorder&gt;().ImplementedBy&lt;NotifyingRecorder&gt;());
  container.Register(Component.For&lt;IRecorder&gt;().ImplementedBy&lt;ModelUpdatingRecorder&gt;());
  </code></pre>
  
  <p>Resolving an <code>IRecorder</code> will never work here, since <code>ModelUpdatingRecorder</code> has a non-optional dependency.  I cannot use a static dependency since <code>seed</code> is not known at compile-time.</p>
  
  <p>Is there a way to specify the <code>seed</code> parameter at runtime and have the decoration still work?</p>
  
  <p><em>This code sample is a simplification of my scenario, but the idea is the same.  I have decorators, and the lowest one relies on a specific value/instance to be provided to it.</em></p>