I wish to use proxy objects in c#. I will probably implement the networking through Windows Communication Foundation. So far I’ve just made a very basic WCF service which works on different processes of on the same computer. I want the client class to be able to use the real object on the same process and use a proxy object to access the real object across the internet. Now I can manually make an interface for all the methods, I want to use across the internet, manually make a proxy class which calls a service foe each of those methods, and manually create each of those services on both the service host and service client.
However is the any way I can get WCF or any software to automatically create the interface and the proxy class?
It sounds like what you want to use is
svcutil.exe, which is intended to read a service’s metadata and create C# classes.Documentation is here: http://msdn.microsoft.com/en-us/library/aa347733.aspx
and more specifically here: http://msdn.microsoft.com/en-us/library/aa751905.aspx
There are a broad (very broad!) range of options controlling the proxy classes that are generated. At its simplest
svcutil http://service/metadataEndpoint
will read the metadata and create C# classes in one go.
Alternatively, if you’re using Visual Studio 2005 or above, right-click on a project, choose “Add service reference…” and follow the dialogs to generate client proxies. This allows you to easily customise the proxy classes.
Note that you will need to publish metadata of some kind for the utility to work. See here: http://msdn.microsoft.com/en-us/library/ms734765.aspx for details on enabling this.