Carrotware.CMS.Core.SiteData.GetSiteFromCache C# (CSharp) Метод

GetSiteFromCache() публичный статический Метод

public static GetSiteFromCache ( System.Guid siteID ) : SiteData
siteID System.Guid
Результат SiteData
        public static SiteData GetSiteFromCache(Guid siteID)
        {
            string ContentKey = SiteKeyPrefix + siteID.ToString();
            SiteData currentSite = null;
            if (IsWebView) {
                try { currentSite = (SiteData)HttpContext.Current.Cache[ContentKey]; } catch { }
                if (currentSite == null) {
                    currentSite = GetSiteByID(siteID);
                    if (currentSite != null) {
                        HttpContext.Current.Cache.Insert(ContentKey, currentSite, null, DateTime.Now.AddMinutes(5), Cache.NoSlidingExpiration);
                    } else {
                        HttpContext.Current.Cache.Remove(ContentKey);
                    }
                }
            } else {
                currentSite = new SiteData();
                currentSite.SiteID = Guid.Empty;
                currentSite.SiteName = "MOCK SITE";
                currentSite.SiteTagline = "MOCK SITE TAGLINE";
                currentSite.MainURL = "http://localhost";
                currentSite.Blog_FolderPath = "archive";
                currentSite.Blog_CategoryPath = "category";
                currentSite.Blog_TagPath = "tag";
                currentSite.Blog_DatePath = "date";
                currentSite.Blog_EditorPath = "author";
                currentSite.TimeZoneIdentifier = "UTC";
                currentSite.Blog_DatePattern = "yyyy/MM/dd";
            }
            return currentSite;
        }

Usage Example

Пример #1
0
        internal SiteNav(vw_carrot_Content c)
        {
            if (c != null)
            {
                SiteData site = SiteData.GetSiteFromCache(c.SiteID);

                this.Root_ContentID   = c.Root_ContentID;
                this.SiteID           = c.SiteID;
                this.FileName         = c.FileName;
                this.Thumbnail        = c.PageThumbnail;
                this.ShowInSiteMap    = c.ShowInSiteMap;
                this.BlockIndex       = c.BlockIndex;
                this.PageActive       = c.PageActive;
                this.CreateDate       = site.ConvertUTCToSiteTime(c.CreateDate);
                this.GoLiveDate       = site.ConvertUTCToSiteTime(c.GoLiveDate);
                this.RetireDate       = site.ConvertUTCToSiteTime(c.RetireDate);
                this.EditDate         = site.ConvertUTCToSiteTime(c.EditDate);
                this.EditUserId       = c.EditUserId;
                this.CreditUserId     = c.CreditUserId;
                this.ShowInSiteNav    = c.ShowInSiteNav;
                this.CreateUserId     = c.CreateUserId;
                this.ContentType      = ContentPageType.GetTypeByID(c.ContentTypeID);
                this.ContentID        = c.ContentID;
                this.Parent_ContentID = c.Parent_ContentID;
                this.TitleBar         = c.TitleBar;
                this.NavMenuText      = c.NavMenuText;
                this.PageHead         = c.PageHead;
                this.PageText         = c.PageText;
                this.NavOrder         = c.NavOrder;
                this.TemplateFile     = c.TemplateFile;
            }
        }
All Usage Examples Of Carrotware.CMS.Core.SiteData::GetSiteFromCache