string AzureConfigurationSourceReplacementExample()
    {
        #region azure-configuration-source-replacement

        var    sectionName   = "mySection";
        var    attributeName = "myAttribute";
        string value;
        if (SafeRoleEnvironment.IsAvailable)
        {
            var key = sectionName + "." + attributeName;
            value = SafeRoleEnvironment.GetConfigurationSettingValue(key);
        }
        else
        {
            var section = ConfigurationResolver.GetConfigurationHandler()
                          .GetSection(sectionName) as MyConfigurationSection;
            value = section.MyAttribute;
        }

        // return value; // value for mySection.myAttribute

        #endregion

        return(value);
    }
Пример #2
0
        public string GetSetting(string name)
        {
            if (!SafeRoleEnvironment.IsAvailable)
            {
                return(string.Empty);
            }

            return(SafeRoleEnvironment.GetConfigurationSettingValue(name));
        }