title: Castle project per session lifestyle with ASP.NET MVC
body: <p>I'm really new to Castle Windsor IoC container. I wanted to know if theres a way to store session variables using the IoC container. I was thinking something in the line of this:</p>
  
  <p>I want to have a class to store search options: </p>
  
  <pre><code>public interface ISearchOptions{
      public string Filter{get;set;}
      public string SortOrder{get;set;}
  }
  
  public class SearchOptions{
      public string Filter{get;set;}
      public string SortOrder{get;set;}
  }
  </code></pre>
  
  <p>And then inject that into the class that has to use it:</p>
  
  <pre><code>public class SearchController{
      private ISearchOptions _searchOptions;
      public SearchController(ISearchOptions searchOptions){
          _searchOptions=searchOptions;
      }
      ...
  }
  </code></pre>
  
  <p>then in my web.config, where I configure castle I want to have something like:</p>
  
  <pre><code>&lt;castle&gt;
      &lt;components&gt;
          &lt;component id="searchOptions" service="Web.Models.ISearchOptions, Web" type="Web.Models.SearchOptions, Web" lifestyle="PerSession" /&gt;
      &lt;/components&gt;
  &lt;/castle&gt;
  </code></pre>
  
  <p>And have the IoC container handle the session object without having to explicitly access it myself.</p>
  
  <p>How can I do this?</p>
  
  <p>Thanks.</p>
  
  <p><strong>EDIT:</strong> Been doing some research. Basically, what I want is to have the a session Scoped component. I come from Java and Spring Framework and there I have session scoped beans which I think are very useful to store session data.</p>