Given this interface
[ServiceContract] public interface IProductService { [OperationContract] Product Get(int id); }
I would like to manually (i.e. without using scvutil or Add Service Reference in VS) create a proxy server on the client side.
I do it as follows
public class ProductService: IProductService { readonly ChannelFactory<IProductService> factory; public ProductService() { factory = new ChannelFactory<IProductService>("*"); } public Product Get(int id) { var channel = factory.CreateChannel(); return channel.Get(id); } }
My problem is that I also want the version of this method to be used as asynchronous / waiting, only on the client side, the server side is still synchronous.
I want this to be a general solution , because I have many methods and services of this kind.
source share