title: How do I get access to the WCF service instance in the current context?
body: <p>If I am executing within the context of a particular service instance and operation, how do I get access to the currently-executing service instance? Service instances don't inherit from any specific common base class or interface and the only pathway into the existing context that I can find is:</p>
  
  <pre><code>OperationContext.Current
  </code></pre>
  
  <p>but I can't seem to find any properties that reference the actual service instance itself so that I can cast it to what I know it should be and perform operations on it.</p>
  
  <p>Without exploring why I am doing this (it's irrelevant), please let me know if there is any way to find the reference I am looking for.</p>
  
  <p><strong>EDIT:</strong></p>
  
  <pre><code>[ServiceContract]
  public interface IInventory
  {
      [OperationContract]
      List&lt;DealInfo&gt; ListDeals(DealQueryOptions options);
  }
  
  // This is the object I will need access to the current instance of
  public class Inventory : ServiceBase&lt;Inventory&gt;, IInventory
  {
      public List&lt;DealInfo&gt; ListDeals(DealQueryOptions options)
      {
          var obj = new Whatever(); // see below
      }
  }
  
  public class Whatever
  {
      public Whatever()
      {
          // how do I get access to the service instance here?
          // assume that in this context we are not allowed to
          // pass the service instance to this class; this class
          // must automatically discover the instance itself.
      }
  }
  </code></pre>