Example #1
0
        internal void WriteBinding(Binding binding, out string bindingSectionName, out string configurationName)
        {
            BindingDictionaryValue result = CreateBindingConfig(binding);

            configurationName  = result.BindingName;
            bindingSectionName = result.BindingSectionName;
        }
        internal void WriteBinding(Binding binding, out string bindingSectionName, out string configurationName)
        {
            BindingDictionaryValue value2 = this.CreateBindingConfig(binding);

            configurationName  = value2.BindingName;
            bindingSectionName = value2.BindingSectionName;
        }
        internal ChannelEndpointElement WriteChannelDescription(ServiceEndpoint endpoint, string typeName)
        {
            ChannelEndpointElement element = null;
            BindingDictionaryValue value2  = this.CreateBindingConfig(endpoint.Binding);

            element = new ChannelEndpointElement(endpoint.Address, typeName)
            {
                Name = NamingHelper.GetUniqueName(NamingHelper.CodeName(endpoint.Name), new NamingHelper.DoesNameExist(this.CheckIfChannelNameInUse), null),
                BindingConfiguration = value2.BindingName,
                Binding = value2.BindingSectionName
            };
            this.channels.Add(element);
            return(element);
        }
 private BindingDictionaryValue CreateBindingConfig(Binding binding)
 {
     BindingDictionaryValue value2;
     if (!this.bindingTable.TryGetValue(binding, out value2))
     {
         string str2;
         string name = NamingHelper.GetUniqueName(NamingHelper.CodeName(binding.Name), new NamingHelper.DoesNameExist(this.CheckIfBindingNameInUse), null);
         if (!BindingsSection.TryAdd(name, binding, this.config, out str2))
         {
             throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(SR.GetString("ConfigBindingCannotBeConfigured"), "endpoint.Binding"));
         }
         value2 = new BindingDictionaryValue(name, str2);
         this.bindingTable.Add(binding, value2);
     }
     return value2;
 }
        private BindingDictionaryValue CreateBindingConfig(Binding binding)
        {
            BindingDictionaryValue value2;

            if (!this.bindingTable.TryGetValue(binding, out value2))
            {
                string str2;
                string name = NamingHelper.GetUniqueName(NamingHelper.CodeName(binding.Name), new NamingHelper.DoesNameExist(this.CheckIfBindingNameInUse), null);
                if (!BindingsSection.TryAdd(name, binding, this.config, out str2))
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(System.ServiceModel.SR.GetString("ConfigBindingCannotBeConfigured"), "endpoint.Binding"));
                }
                value2 = new BindingDictionaryValue(name, str2);
                this.bindingTable.Add(binding, value2);
            }
            return(value2);
        }
        BindingDictionaryValue CreateBindingConfig(Binding binding)
        {
            BindingDictionaryValue bindingDV;
            if (!bindingTable.TryGetValue(binding, out bindingDV))
            {
                // [....]: review: Use decoded form to preserve the user-given friendly name, however, beacuse our Encoding algorithm
                // does not touch ASCII names, a name that looks like encoded name will not roundtrip(Example: "_x002C_" will turned into ",")
                string bindingName = NamingHelper.GetUniqueName(NamingHelper.CodeName(binding.Name), this.CheckIfBindingNameInUse, null);
                string bindingSectionName;

                if (!BindingsSection.TryAdd(bindingName, binding, config, out bindingSectionName))
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(SR.GetString(SR.ConfigBindingCannotBeConfigured), "endpoint.Binding"));

                bindingDV = new BindingDictionaryValue(bindingName, bindingSectionName);
                bindingTable.Add(binding, bindingDV);
            }
            return bindingDV;
        }
Example #7
0
        internal ChannelEndpointElement WriteChannelDescription(ServiceEndpoint endpoint, string typeName)
        {
            ChannelEndpointElement channelElement = null;

            // Create Binding
            BindingDictionaryValue bindingDV = CreateBindingConfig(endpoint.Binding);


            channelElement = new ChannelEndpointElement(endpoint.Address, typeName);

            // [....]: review: Use decoded form to preserve the user-given friendly name, however, beacuse our Encoding algorithm
            // does not touch ASCII names, a name that looks like encoded name will not roundtrip(Example: "_x002C_" will turned into ",")
            channelElement.Name = NamingHelper.GetUniqueName(NamingHelper.CodeName(endpoint.Name), this.CheckIfChannelNameInUse, null);

            channelElement.BindingConfiguration = bindingDV.BindingName;
            channelElement.Binding = bindingDV.BindingSectionName;
            channels.Add(channelElement);

            return(channelElement);
        }
Example #8
0
        BindingDictionaryValue CreateBindingConfig(Binding binding)
        {
            BindingDictionaryValue bindingDV;

            if (!bindingTable.TryGetValue(binding, out bindingDV))
            {
                // [....]: review: Use decoded form to preserve the user-given friendly name, however, beacuse our Encoding algorithm
                // does not touch ASCII names, a name that looks like encoded name will not roundtrip(Example: "_x002C_" will turned into ",")
                string bindingName = NamingHelper.GetUniqueName(NamingHelper.CodeName(binding.Name), this.CheckIfBindingNameInUse, null);
                string bindingSectionName;

                if (!BindingsSection.TryAdd(bindingName, binding, config, out bindingSectionName))
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(SR.GetString(SR.ConfigBindingCannotBeConfigured), "endpoint.Binding"));
                }

                bindingDV = new BindingDictionaryValue(bindingName, bindingSectionName);
                bindingTable.Add(binding, bindingDV);
            }
            return(bindingDV);
        }