private void ApplyConfigSetting(XElement configurationSettings, string key)
{
XNamespace ns = CsdefNamespace;
XmlNamespaceManager namespaceManager = new XmlNamespaceManager(new NameTable());
namespaceManager.AddNamespace("csdef", CsdefNamespace);
string xpath = String.Format("csdef:Setting[@name='{0}']", key);
XElement appSetting = configurationSettings.XPathSelectElement(xpath, namespaceManager);
if (appSetting == null)
{
appSetting = new XElement(ns + "Setting", new XAttribute("name", key));
configurationSettings.Add(appSetting);
}
}
}