private void BindModuleCacheProviderList()
 {
     cboModuleCacheProvider.DataSource = GetFilteredProviders(ModuleCachingProvider.GetProviderList(), "ModuleCachingProvider");
     cboModuleCacheProvider.DataBind();
     if (cboModuleCacheProvider.Items.Count > 0)
     {
         var    defaultModuleCache = ComponentFactory.GetComponent <ModuleCachingProvider>();
         string providerKey        = (from provider in ModuleCachingProvider.GetProviderList() where provider.Value.Equals(defaultModuleCache) select provider.Key).SingleOrDefault();
         if (!string.IsNullOrEmpty(Entities.Host.Host.ModuleCachingMethod))
         {
             if (cboModuleCacheProvider.FindItemByValue(Entities.Host.Host.ModuleCachingMethod) != null)
             {
                 cboModuleCacheProvider.FindItemByValue(Entities.Host.Host.ModuleCachingMethod).Selected = true;
             }
             else
             {
                 cboModuleCacheProvider.FindItemByValue(providerKey).Selected = true;
             }
         }
         else
         {
             cboModuleCacheProvider.FindItemByValue(providerKey).Selected = true;
         }
     }
 }
        public string GetEffectiveCacheMethod()
        {
            string effectiveCacheMethod;

            if (!string.IsNullOrEmpty(this.CacheMethod))
            {
                effectiveCacheMethod = this.CacheMethod;
            }
            else if (!string.IsNullOrEmpty(Host.Host.ModuleCachingMethod))
            {
                effectiveCacheMethod = Host.Host.ModuleCachingMethod;
            }
            else
            {
                var defaultModuleCache = ComponentFactory.GetComponent <ModuleCachingProvider>();
                effectiveCacheMethod = (from provider in ModuleCachingProvider.GetProviderList() where provider.Value.Equals(defaultModuleCache) select provider.Key).SingleOrDefault();
            }

            if (string.IsNullOrEmpty(effectiveCacheMethod))
            {
                throw new InvalidOperationException(Localization.GetString("EXCEPTION_ModuleCacheMissing"));
            }

            return(effectiveCacheMethod);
        }
        private void BindModuleCacheProviderList()
        {
            cboCacheProvider.DataSource = GetFilteredProviders(ModuleCachingProvider.GetProviderList(), "ModuleCachingProvider");
            cboCacheProvider.DataBind();

            cboCacheProvider.Items.Insert(0, new ListItem(Localization.GetString("None_Specified"), ""));

            if (!string.IsNullOrEmpty(Module.GetEffectiveCacheMethod()) && cboCacheProvider.Items.FindByValue(Module.GetEffectiveCacheMethod()) != null)
            {
                cboCacheProvider.Items.FindByValue(Module.GetEffectiveCacheMethod()).Selected = true;
            }
            else
            {
                //select the None Specified value
                cboCacheProvider.Items[0].Selected = true;
            }

            lblCacheInherited.Visible = Module.CacheMethod != Module.GetEffectiveCacheMethod();
        }
Exemple #4
0
 public IEnumerable <KeyValuePair <string, string> > GetModuleCacheProviders()
 {
     return(GetFilteredProviders(ModuleCachingProvider.GetProviderList(), "ModuleCachingProvider"));
 }