<commit_before>﻿using Microsoft.WindowsAzure;
using Orchard.Environment.Configuration;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Orchard.Azure.Services.Environment.Configuration {

    public static class PlatformConfiguration {

        /// <summary>
        /// Reads a setting from platform configuration, trying first prefixed with the current tenant name and
        /// secondly with no prefix.
        /// </summary>
        /// <param name="name">The name of the setting to read.</param>
        /// <param name="shellSettings">The ShellSettings object for the current tenant.</param>
        /// <param name="namePrefix">An optional prefix to prepend the setting name with.</param>
        /// <returns>The value of the setting if found with or without tenant name prefix, otherwise null.</returns>
        public static string GetSetting(string name, ShellSettings shellSettings, string namePrefix = null) {
            var tenantName = String.Format("{0}_{1}{2}", shellSettings.Name, namePrefix, name);
            var fallbackName = String.Format("{0}{1}", namePrefix, name);
            return CloudConfigurationManager.GetSetting(tenantName) ?? CloudConfigurationManager.GetSetting(fallbackName);
        }
    }
}<commit_msg>Changed tenant name prefix separator in platform configuration reader.<commit_after>﻿using Microsoft.WindowsAzure;
using Orchard.Environment.Configuration;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Orchard.Azure.Services.Environment.Configuration {

    public static class PlatformConfiguration {

        /// <summary>
        /// Reads a setting from platform configuration, trying first prefixed with the current tenant name and
        /// secondly with no prefix.
        /// </summary>
        /// <param name="name">The name of the setting to read.</param>
        /// <param name="shellSettings">The ShellSettings object for the current tenant.</param>
        /// <param name="namePrefix">An optional prefix to prepend the setting name with.</param>
        /// <returns>The value of the setting if found with or without tenant name prefix, otherwise null.</returns>
        public static string GetSetting(string name, ShellSettings shellSettings, string namePrefix = null) {
            var tenantName = String.Format("{0}:{1}{2}", shellSettings.Name, namePrefix, name);
            var fallbackName = String.Format("{0}{1}", namePrefix, name);
            return CloudConfigurationManager.GetSetting(tenantName) ?? CloudConfigurationManager.GetSetting(fallbackName);
        }
    }
}
{'fraction_non_alphanumeric': 0.10359168241965974, 'fraction_numerical': 0.003780718336483932, 'mean_word_length': 3.366336633663366, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1379037', 'n_tokens_mistral': 627, 'n_tokens_neox': 620, 'n_words': 216}