title: Passing parameters to a WCF ServiceHost type with Ninject 2
body: <p>I want to use a Ninject.Wcf extension to create a parametrized service host instance.</p>
  
  <p>For example I have a class <code>MyWCFHandler</code> with the only following constructor:</p>
  
  <pre><code>public MyWCFHandler(UserManager manager)
  {
    _manager = manager;
  }
  </code></pre>
  
  <p>But when I write <code>var myServiceHost = new ServiceHost(typeof(MyWCFHandler));</code> I have no way to pass the dependency object to a constructor.</p>
  
  <p>I don't want to mess with the custom ServiceHost like offered in 
  <a href="https://stackoverflow.com/questions/2454850/how-do-i-pass-values-to-the-constructor-on-my-wcf-service">How do I pass values to the constructor on my wcf service?</a></p>
  
  <p>I decided to go with the Ninject way, but not able to fully understand how to act in my situation. </p>
  
  <p>Here is what I understand WCF Extension in Ninject works:</p>
  
  <ol>
  <li>Reference Ninject and Ninject.Extensions.WCF in my project.</li>
  <li><p>Create a class that inherits Ninject module and write something like:</p>
  
  <p><code>internal class ServiceModule : NinjectModule
  {
      public override void Load()
              {
                  Bind&lt;IUserManager&gt;().To&lt;UserManager&gt;().WithConstructorParameters(myUserManagerIwantToUseInWCFHandler);
              }
  }</code></p></li>
  <li><p>Add a Kernel initialized with new ServiceModule() to a KernelContainer.</p></li>
  <li><p>Use the NinjectServiceHost like this:</p>
  
  <p><code>var service = KernelContainer.Kernel.Get&lt;IMyWCFHandler&gt;();
              _host = new NinjectServiceHost( service );</code></p></li>
  </ol>
  
  <p>And there I should have my host ready to be opened. </p>
  
  <p>The questions are:</p>
  
  <p>How should I pass my constructor parameters into a NinjectModule? Should I create an instance of a NinjectModule right when I am ready to bind a parameter to it? How do I pass them to Get method?</p>
  
  <p>Unfortunately there is not one example around to simple show the parametrized ServiceHost start. I don't even care if it is Ninject I use. Whichever solution has a good example - I am fine with it, since I am just deciding what IoC container to use. </p>