Click here to Skip to main content
Click here to Skip to main content
Alternative Tip

Do not use "using" for WCF Clients

By , 18 May 2011
Rate this:
Please Sign up or sign in to vote.
Good Tip, got my 5!
 
As an alternative to your tip, when using generated proxies you could also add the logic to a partial class with the same name as the proxy class, see below.
 
public partial class MyGeneratedProxyClient : IDisposable
{
   void IDisposable Dispose()
   {
      try
      {
         if (this.State == CommunicationState.Faulted)
           this.Abort();
         else
           this.Close();
       }
       catch
       {
         this.Abort();
       }
   }
}

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Patrick Kalkman
Architect http://www.hinttech.nl
Netherlands Netherlands
Patrick Kalkman is a senior Software Architect with more than 20 years professional development experience. He works for Hinttech where he develops state of the art web applications.

Patrick enjoys writing his blog. It discusses software architectures using semantic web technologies. Patrick can be reached at pkalkie@gmail.com.
 
Published Windows 8 apps:
 
Published Windows Phone apps:
 
Awards:

Best Mobile article of March 2012
Best Mobile article of June 2012
Follow on   Twitter

Comments and Discussions

 
-- There are no messages in this forum --
| Advertise | Privacy | Mobile
Web04 | 2.8.140421.2 | Last Updated 18 May 2011
Article Copyright 2011 by Patrick Kalkman
Everything else Copyright © CodeProject, 1999-2014
Terms of Use
Layout: fixed | fluid