newtelligence.DasBlog.Web.SiteConfig.GetSiteConfig C# (CSharp) Method

GetSiteConfig() public static method

public static GetSiteConfig ( ) : SiteConfig
return SiteConfig
        public static SiteConfig GetSiteConfig()
        {
            DataCache cache = CacheFactory.GetCache();

            SiteConfig config = (SiteConfig) cache["SiteConfig"];
            if (config == null)
            {
                string path = GetConfigFilePathFromCurrentContext();
                config = GetSiteConfig(path);
                cache.Insert("SiteConfig", config, new CacheDependency(path));
            }
            return config;
        }

Same methods

SiteConfig::GetSiteConfig ( string configPath ) : SiteConfig

Usage Example

        /// <summary>
        /// Creates and returns instance of a <see cref="Core.EditControlAdapter"/> based on the site configuration.
        /// </summary>
        /// <returns>An instance of <see cref="Core.EditControlAdapter"/></returns>
        public static EditControlAdapter CreateEditControl <TDefault>()
            where TDefault : EditControlAdapter, new()
        {
            SiteConfig siteConfig            = SiteConfig.GetSiteConfig();
            string     configuredEditControl = siteConfig.EntryEditControl;

            Core.EditControlAdapter editControl;

            Type editControlType;

            // try the configured control
            if (TryGetType(configuredEditControl, out editControlType) && TryCreateControl(editControlType, out editControl))
            {
                return(editControl);
            }

            // try the requested default
            if (TryCreateControl(typeof(TDefault), out editControl))
            {
                return(editControl);
            }

            // if all else failed, default to the plain textbox, since that doesn't depend on external assemblies.
            return(new TextBoxAdapter());
        }
All Usage Examples Of newtelligence.DasBlog.Web.SiteConfig::GetSiteConfig