title: Using ServiceStack Funq IoC: how dependencies are injected?
body: <p>I have WinForm application and I want to use ServiceStack dependency injection mechanism:</p>
  
  <pre><code>public class AppHost : AppHostBase
  {
      public AppHost()
          : base("MyName", typeof(AppHost).Assembly)
      {
      }
  
      public override void Configure(Container container)
      {
          container.RegisterAutoWiredAs&lt;AppApplicationContext, IAppApplicationContext&gt;();
      }
  }
  </code></pre>
  
  <p>Then in some form class use it:</p>
  
  <pre><code>public class SomeClass : AppBaseForm
  {
      public IAppApplicationContext AppApplicationContext { get; set; }
  
      public SomeClass(IAppApplicationContext appApplicationContext)
      {
          AppApplicationContext = appApplicationContext;
      }
  
      public SomeClass()
      {
      }
  }
  </code></pre>
  
  <p>But <code>AppApplicationContext</code> is always <code>null</code>. When in parameterless constructor I write:</p>
  
  <pre><code>AppApplicationContext = AppHostBase.Resolve&lt;IAppApplicationContext&gt;();
  </code></pre>
  
  <p>then every thing is OK. But is this right way to do that? I mean AppApplicationContext should not be resolved by IoC automatically? And WinForm must have parameterless constructor.</p>
  
  <p>Rest of code:</p>
  
  <pre><code>private static void Main()
  {
      var appHost = new AppHost();
      appHost.Init();
  }
  
  public interface IAppApplicationContext
  {
  }
  
  public class AppApplicationContext : IAppApplicationContext
  {
  }
  </code></pre>