title: Server Side WCF Service : How to reference/interact with other server components
body: <p>I have a fairly simple design question about interaction between a self hosted WCF Service and other business classes.</p>
  
  <p>Here is the WCF service contract : </p>
  
  <pre><code>/// &lt;summary&gt;
  /// Represent requests on hardware components made by a client to the controler service
  /// &lt;/summary&gt;
  [ServiceContract(CallbackContract = typeof(IHardwareServiceCallback))]
  public interface IHardwareService
  {
      [OperationContract(IsOneWay = true)]
      void OpenLeftDrawer();
  
      [OperationContract(IsOneWay = true)]
      void OpenRightDrawer();
  }
  </code></pre>
  
  <p>The service implementation</p>
  
  <pre><code>public class HardwareService : IHardwareService
  {
      public void OpenLeftDrawer()
      {
  
      }
  
      public void OpenRightDrawer()
      {
  
      }
  
  }
  </code></pre>
  
  <p>A class which purpose is to handle the business logic regarding client calls on the server</p>
  
  <pre><code>class DrawerRequestManager
  {
      // Server side Business logic to handle OpenDrawer requests from client
  }
  </code></pre>
  
  <p>Hosting scenario</p>
  
  <pre><code> Uri adrbase = new Uri(srvConfig.Address);
   var host = new ServiceHost(typeof(HardwareService), adrbase);
   host.AddServiceEndpoint(typeof(IHardwareService), srvConfig.Binding, srvConfig.Address);
   host.Open();
  </code></pre>
  
  <p>Since this is the host that is managing the service instance lifetime, what is the <strong>proper way</strong> to handle the link between the service instance and business logic classes (<code>DrawerRequestManager</code> for exemple).</p>
  
  <p>I'm using IOC container but i'm also interested in the response when not using IOC container.</p>
  
  <p>Thanks in advance !</p>