public function setConfigurationSetting($roleName, $name, $value)
    {
        $namespaceUri = $this->dom->lookupNamespaceUri($this->dom->namespaceURI);
        $xpath = new \DOMXpath($this->dom);
        $xpath->registerNamespace('sc', $namespaceUri);

        $xpathExpression = '//sc:Role[@name="' . $roleName . '"]//sc:ConfigurationSettings//sc:Setting[@name="' . $name . '"]';
        $settingList = $xpath->evaluate($xpathExpression);

        if ($settingList->length == 1) {
            $settingNode = $settingList->item(0);
        } else {
            $settingNode = $this->dom->createElementNS($namespaceUri, 'Setting');
            $settingNode->setAttribute('name', $name);

            $configSettingList = $xpath->evaluate('//sc:Role[@name="' . $roleName . '"]/sc:ConfigurationSettings');

            if ($configSettingList->length == 0) {
                throw new \RuntimeException("Cannot find <ConfigurationSettings /> in Role '" . $roleName . "'.");
            }

            $configSettings = $configSettingList->item(0);
            $configSettings->appendChild($settingNode);
        }

        $settingNode->setAttribute('value', $value);

        $this->save();
    }
public function setConfigurationSetting($roleName, $name, $value)
    {
        $namespaceUri = $this->dom->lookupNamespaceUri($this->dom->namespaceURI);
        $xpath = new \DOMXpath($this->dom);
        $xpath->registerNamespace('sc', $namespaceUri);

        $xpathExpression = '//sc:Role[@name="' . $roleName . '"]//sc:ConfigurationSettings//sc:Setting[@name="' . $name . '"]';
        $settingList = $xpath->evaluate($xpathExpression);

        if ($settingList->length == 1) {
            $settingNode = $settingList->item(0);
        } else {
            $settingNode = $this->dom->createElementNS($namespaceUri, 'Setting');
            $settingNode->setAttribute('name', $name);

            $configSettingList = $xpath->evaluate('//sc:Role[@name="' . $roleName . '"]/sc:ConfigurationSettings');

            if ($configSettingList->length == 0) {
                throw new \RuntimeException("Cannot find <ConfigurationSettings /> in Role '" . $roleName . "'.");
            }

            $configSettings = $configSettingList->item(0);
            $configSettings->appendChild($settingNode);
        }

        $settingNode->setAttribute('value', $value);

        $this->save();
    }
public function setConfigurationSetting ( $ roleName , $ name , $ value ) { $ namespaceUri = $ this -> dom -> lookupNamespaceUri ( $ this -> dom -> namespaceURI ) ; $ xpath = new \ DOMXpath ( $ this -> dom ) ; $ xpath -> registerNamespace ( 'sc' , $ namespaceUri ) ; $ xpathExpression = '//sc:Role[@name="' . $ roleName . '"]//sc:ConfigurationSettings//sc:Setting[@name="' . $ name . '"]' ; $ settingList = $ xpath -> evaluate ( $ xpathExpression ) ; if ( $ settingList -> length == 1 ) { $ settingNode = $ settingList -> item ( 0 ) ; } else { $ settingNode = $ this -> dom -> createElementNS ( $ namespaceUri , 'Setting' ) ; $ settingNode -> setAttribute ( 'name' , $ name ) ; $ configSettingList = $ xpath -> evaluate ( '//sc:Role[@name="' . $ roleName . '"]/sc:ConfigurationSettings' ) ; if ( $ configSettingList -> length == 0 ) { throw new \ RuntimeException ( "Cannot find <ConfigurationSettings /> in Role '" . $ roleName . "'." ) ; } $ configSettings = $ configSettingList -> item ( 0 ) ; $ configSettings -> appendChild ( $ settingNode ) ; } $ settingNode -> setAttribute ( 'value' , $ value ) ; $ this -> save ( ) ; }
Add a configuration setting to the ServiceConfiguration.cscfg

@param string $name
@param string $value
Add a configuration setting to the ServiceConfiguration . cscfg