title: WCF and Interface Inheritance - Is this a terrible thing to do?
body: <p>My application has 2 "services", let's say one is a basic (integer) calculator, and one is a floating point calculator. I express these as interfaces like so:</p>
  
  <pre><code>public interface IBasicCalculator
  {
      int Add( int a, int b );
  }
  
  public interface IFloatingPointCalculator
  {
      double Add( double a, double b );
  }
  </code></pre>
  
  <p>I want to expose these via WCF. Unfortunately WCF seems to be very tightly tied to the notion that every possible operation you want to expose must go through one single service interface -- you can't share sessions between services, it is cumbersome from the client side as you need to create a seperate proxy for each one, there don't seem to be any  "sub-services", etc...</p>
  
  <p>So, I've gathered that I need to present a "combined" interface (one might also call it a facade), like this:</p>
  
  <pre><code>[ServiceContract]
  public interface ICalculatorService : IBasicCalculator, IFloatingPointCalculator
  {
      [OperationContract(Name = "AddInt")]
      new int Add( int a, int b );
  
      [OperationContract(Name = "AddDouble")]
      new double Add( double a, double b );
  }
  </code></pre>
  
  <p>If I do this, then WCF exposes both methods to the client, which can call them, and it all actually works.</p>
  
  <p>However, "inheriting the interfaces" like that seems to be ungainly. <em>Particularly</em> the <strong><code>new</code></strong> <code>int Add</code> and <strong><code>new</code></strong> <code>double Add</code>. Strictly speaking, <code>new</code> on a method indicates hiding an underlying method, which I'm not actually doing at all. I can omit the <code>new</code>, but then I just get compiler warnings which amount to "I think I'm hiding this method, you need to rename it method or put 'new' on it".</p>
  
  <p>So, this is a 2-part question:</p>
  
  <ol>
  <li><p>Am I on track with my 'combine everything into one interface' logic, or is there actually a way to expose "sub-services" or "multiple linked services" using WCF?</p></li>
  <li><p>If this is what needs to be done, is there a better way?</p></li>
  </ol>
  
  <p>Thanks!</p>