Beispiel #1
0
        public TClient CreateService(Bindings bindings)
        {
            var context = default(TClient);

            if (bindings == Bindings.None)
            {
                for (var i = 1; context == null && i < EnumExtensions.Count <Bindings>(); i++)
                {
                    context = this.Create((Bindings)i);
                }
            }
            else
            {
                context = this.Create(bindings);
            }

            if (context == null)
            {
                var contractName = this.Client.FullName;
                throw new EndpointNotFoundException(string.Format("Endpoint with the contract {0} was not found in the config file.", contractName));
            }

            return(context);
        }