Esempio n. 1
0
        public static bool CanSet(string name)
        {
            var value   = string.Empty;
            var section = ConsumerConfigurationSection.GetSection();

            if (section != null)
            {
                var r = section.Keys.GetKey(name);
                if (r == null || string.IsNullOrEmpty(r.ConsumerName))
                {
                    return(false);
                }
                value = section.Keys.GetKeyValue(name);
            }

            return(string.IsNullOrEmpty(value));
        }
Esempio n. 2
0
        public static string Get(string name)
        {
            var tenant = CoreContext.Configuration.Standalone
                             ? Tenant.DEFAULT_TENANT
                             : CoreContext.TenantManager.GetCurrentTenant().TenantId;
            var value = CoreContext.Configuration.GetSetting(GetSettingsKey(name), tenant);

            if (string.IsNullOrEmpty(value))
            {
                var section = ConsumerConfigurationSection.GetSection();
                if (section != null)
                {
                    value = section.Keys.GetKeyValue(name);
                }
            }
            return(value);
        }
Esempio n. 3
0
        public static string Get(string key)
        {
            var value = string.Empty;

            if (CoreContext.Configuration.Standalone)
            {
                value = CoreContext.Configuration.GetSetting(GetSettingsKey(key));
            }
            if (string.IsNullOrEmpty(value))
            {
                var section = ConsumerConfigurationSection.GetSection();
                if (section != null)
                {
                    value = section.Keys.GetKeyValue(key);
                }
            }
            return(value);
        }
Esempio n. 4
0
        public static string Get(string name, bool forDefault = false)
        {
            string value = null;

            if (!(_onlyDefault ?? (bool)(_onlyDefault = ConfigurationManager.AppSettings["core.default-consumers"] == "true")) &&
                CanSet(name))
            {
                var tenant = CoreContext.Configuration.Standalone || forDefault
                                 ? Tenant.DEFAULT_TENANT
                                 : CoreContext.TenantManager.GetCurrentTenant().TenantId;

                value = CoreContext.Configuration.GetSetting(GetSettingsKey(name), tenant);
            }

            if (string.IsNullOrEmpty(value))
            {
                var section = ConsumerConfigurationSection.GetSection();
                if (section != null)
                {
                    value = section.Keys.GetKeyValue(name);
                }
            }
            return(value);
        }
Esempio n. 5
0
        public static string Get(string keyName)
        {
            var section = ConsumerConfigurationSection.GetSection();

            return(section != null?section.Keys.GetKeyValue(keyName) : string.Empty);
        }