Whenever I design a service I have the habbit of wrapping the client-side proxy in a helper class. This shields the end-user from having to deal with the proxy directly and with the clean up code.

The service references and coherent helper classes are put in a seperate class library. Such a helper class provides public methods that delegate to the protected proxy property. If more than one client application uses the service then you can just reference this code library and reuse the helper classes.

An example of this can be found in my “A Combination of WCF Essentials” article. One reader asked the following question:

Interesting article, in particular the part about wrapping the proxy. I’m thinking of wrapping a proxy in a class library, but can’t figure out how to expose the async methods of the proxy to the users of the dll. Do You have any suggestions regarding that?

This article focuses on accomplishing just that. So let’s get started…

Read the rest of this entry »