title: Desktop Application Dependency Injection with Unity
body: <p>I've used unity with MVC Web App.
  and in MVC we there is app_start method.
  and we use</p>
  
  <pre><code>DependencyResolver.SetResolver(new UnityDependencyResolver(container));
  </code></pre>
  
  <p>and this send the parameters to the Controller Constructor.
  now i am trying to find how to implement this pattern to DesktopApplication.</p>
  
  <p>u guys know that we use new Form1().Show(); //bla bla foo
  and when i create a new form is it possible to do when i created a new instance of type of System.Windows.Forms it automatically send the parameters to the constructor.</p>
  
  <p>Sorry for my language.
  now i am using something like this and asking if it's a better solution:</p>
  
  <pre><code>public partial class frm_FirmaSecimi : XtraForm
  {
      private IFirmaService _firmaService;
  
      public frm_FirmaSecimi()
      {
          InitializeComponent();
          _firmaService = UnityConfig.Container.Resolve&lt;IFirmaService&gt;();
      }
  }
  </code></pre>
  
  <p>is there a way to turn this in to:</p>
  
  <pre><code>public partial class frm_FirmaSecimi : XtraForm
  {
      private IFirmaService _firmaService;
  
      public frm_FirmaSecimi(IFirmaService firmaService)
      {
          InitializeComponent();
          _firmaService = firmaService;
      }
  }
  </code></pre>
  
  <p>this is a DevExpress Form by the way.
  Thanx for answers.</p>