Created
September 3, 2015 12:22
-
-
Save vbilopav/2331415cba390458658f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class WcfDynamicSoapProxy<T> : IDisposable where T : class | |
{ | |
public static WcfDynamicSoapProxy<T> CreateProxy(string endpointAdressUri) | |
{ | |
return new WcfDynamicSoapProxy<T>(endpointAdressUri); | |
} | |
protected readonly ChannelFactory<T> DynamicChannelFactory; | |
public T Channel { get; private set; } | |
public WcfDynamicSoapProxy(string endpointAdressUri) | |
{ | |
BasicHttpBinding binding = new BasicHttpBinding(); //'application/soap+xml; charset=utf-8' | |
DynamicChannelFactory = new ChannelFactory<T>(binding, endpointAdressUri); | |
Channel = DynamicChannelFactory.CreateChannel(); | |
} | |
public void Dispose() | |
{ | |
DynamicChannelFactory.Close(); | |
(DynamicChannelFactory as IDisposable).Dispose(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment