title: Castle Windsor Property Injection of IWindsorContainer
body: <p>I am having problems injecting IWindsorContainer as a property. </p>
  
  <p>I am using MVC3. I have created my own IView and ViewEngine. From within the View I dynamically build views based on the types registered in Windsor. </p>
  
  <p>For one condition ( a "list" view) I want to display a list of all the IMyTypes registered with Windsor. 
  In my global.asax I register the Windsor view like this:</p>
  
  <pre><code>container.Register(Component.For&lt;IWindsorContainer&gt;().Instance(container));
  </code></pre>
  
  <p>Then in my IView implementation, I declare a property like this:</p>
  
  <pre><code>public IWindsorContainer Container { get; set; }
  </code></pre>
  
  <p>The actual IView is in another component. When I get to the Render method, I want to do this:</p>
  
  <pre><code>IRuleDataDefinition[] ruleDatas = Container.ResolveAll&lt;IRuleDataDefinition&gt;();
  </code></pre>
  
  <p>But "Container" is always null. Is it because of the way I am creating the IView (I am just using new, it isn't registered with Windsor?) Is it something with the IWindsorContainer itself? Or do I just have everything wrong?</p>
  
  <p>I've also read other people that say "if you are using Container.Resolve you are probably doing it wrong." So if I am doing this wrong, please let me know.</p>
  
  <hr>
  
  <p>EDIT</p>
  
  <p>Perhaps a better way to phrase the question is: What is the best way to do the equivalent of container.ResolveAll() when you don't have a reference to the container? I need to loop through all registered versions of IMyType.</p>
  
  <hr>
  
  <p>EDIT THE 2ND</p>
  
  <p>I got it to work by using Windsor for the entire dependency chain, which, of course, is what you are supposed to do, I learned.</p>