/// <summary> /// Given XML Config with <endpoint> element check for binding. /// </summary> /// <param name="config">XML object for config</param> /// <param name="bindingsTransportMap">Dictionary of binding and transport mode</param> public static void EndpointTagCheck(WebConfigXDocument config, Dictionary <string, BindingConfiguration> bindingsTransportMap) { var endpointElement = config.GetElementByPath(Constants.WCFEndpointElementPath); var binding = endpointElement.Attribute(Constants.BindingAttribute); if (binding != null) { bindingsTransportMap[binding.Value.ToLower()] = new BindingConfiguration(); } }
/// <summary> /// Given XML Config with <protocolMapping> element, check for binding and transport mode. /// </summary> /// <param name="config">XML object for config</param> /// <param name="bindingsTransportMap">Dictionary of binding and transport mode</param> public static void ProtocolTagCheck(WebConfigXDocument config, Dictionary <string, BindingConfiguration> bindingsTransportMap) { var protocolElement = config.GetElementByPath(Constants.WCFProtocolMappingElement); var addProtocolElementsList = protocolElement.Elements(Constants.AddElement); foreach (var addProtocolElement in addProtocolElementsList) { var binding = addProtocolElement.Attribute(Constants.BindingAttribute); if (binding != null) { var bindingName = binding.Value.ToLower(); bindingsTransportMap[bindingName] = new BindingConfiguration(); } } }
/// <summary> /// Given XML Config with <bindings> element, check for binding and transport mode. /// </summary> /// <param name="config">XML object for config</param> /// <param name="bindingsTransportMap">Dictionary of binding and transport mode</param> public static void BindingTagCheck(WebConfigXDocument config, Dictionary <string, BindingConfiguration> bindingsTransportMap) { var bindingsElement = config.GetElementByPath(Constants.WCFBindingElementPath); var bindingsList = bindingsElement.Elements(); foreach (var binding in bindingsList) { var bindingName = binding.Name.ToString().ToLower(); var bindingElements = binding.Elements(); foreach (var bindingElement in bindingElements) { var modeList = bindingElement.Descendants(Constants.SecurityElement); if (modeList.IsNullOrEmpty()) { bindingsTransportMap[bindingName] = new BindingConfiguration(); } foreach (var securityElement in modeList) { var modeName = securityElement.Attribute(Constants.ModeAttribute); if (modeName != null) { bindingsTransportMap[bindingName] = new BindingConfiguration { Mode = modeName.Value.ToLower() }; break; } } } } }