title: Injection WCF proxy client using unity
body: <p>I have an asp.net mvc application and need to call wcf service in it. I've added service reference to the project. I use unity for dependency injection and want to inject wcf client. But it's not so simple because of System.ServiceModel.ClientBase. I did it this way.<br/>
  This is an autogenerated proxy:</p>
  
  <pre><code>public partial class WcfServiceClient : 
      System.ServiceModel.ClientBase&lt;WcfUnity.IWcfServiceClient&gt;, 
      WcfUnity.IWcfServiceClient 
  {
      //autogenerated constructors and methods
  }
  </code></pre>
  
  <p>I created interface:</p>
  
  <pre><code>public interface ISimpleProxy : WcfUnity.IWcfServiceClient
  {
      //duplication of methods' signatures
      void CloseConnection();
  }
  </code></pre>
  
  <p>I extended WcfServiceClient using partial class: </p>
  
  <pre><code>public partial class WcfServiceClient : ISimpleProxy
  {
      public void CloseConnection()
      {
          try
          {
              Close();
          }
          catch (Exception)
          {
              Abort();
          }
      }
  }
  </code></pre>
  
  <p>And inject it like this:</p>
  
  <pre><code>container.RegisterType&lt;ISimpleProxy&gt;(new InjectionFactory(c =&gt; new WcfServiceClient()));
  </code></pre>
  
  <p>So I don't have dependecies from ClientBase and there is no wcf stuff inside classes which use this wcf proxy. Does this solution have some disadvatages?</p>