Example #1
0
        /// <summary>
        /// Creates the reusable disco client.
        /// </summary>
        /// <returns></returns>
        public static IDisco CreateReusableDiscoClient(string cfg = null)
        {
            if (String.IsNullOrWhiteSpace(cfg))
            {
                cfg = ConfigurationHelper.DiscoEndpoint;
            }
            var address = new EndpointAddress(cfg);
            var uri     = new Uri(cfg);

            if (uri.Scheme == Uri.UriSchemeNetPipe)
            {
                return(WCFClientProxy <IDisco> .GetReusableInstance(
                           BindingFactory.CreateBindingFromKey(BindingFactory.Key.NetNamedPipeBinding),
                           address));
            }
            else if (uri.Scheme == Uri.UriSchemeHttp)
            {
                return(WCFClientProxy <IDisco> .GetReusableInstance(
                           BindingFactory.CreateBindingFromKey(BindingFactory.Key.BasicHttpBindingNoSecurity),
                           address));
            }
            else if (uri.Scheme == Uri.UriSchemeHttps)
            {
                return(WCFClientProxy <IDisco> .GetReusableInstance(
                           BindingFactory.CreateBindingFromKey(BindingFactory.Key.BasicHttpBindingTransportSecurity),
                           address));
            }
            else
            {
                return(WCFClientProxy <IDisco> .GetReusableInstance(cfg));
            }
        }
 static WCFReusableClientProxy()
 {
     _instanceType = WCFClientProxy <T> .GetInstanceType();
 }