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); }