Beispiel #1
0
        public static NewsPress GetByID(int NewsPressID, IEnumerable <string> includeList = null)
        {
            NewsPress obj = null;
            string    key = cacheKeyPrefix + NewsPressID + GetCacheIncludeText(includeList);

            NewsPress tmpClass = null;

            if (Cache.IsEnabled)
            {
                if (Cache.IsEmptyCacheItem(key))
                {
                    return(null);
                }
                tmpClass = Cache[key] as NewsPress;
            }

            if (tmpClass != null)
            {
                obj = tmpClass;
            }
            else
            {
                using (Entities entity = new Entities())
                {
                    IQueryable <NewsPress> itemQuery = AddIncludes(entity.NewsPress, includeList);
                    obj = itemQuery.FirstOrDefault(n => n.NewsPressID == NewsPressID);
                }
                Cache.Store(key, obj);
            }

            return(obj);
        }
Beispiel #2
0
 public NewsPress(NewsPress objectToCopy)
 {
     Active      = objectToCopy.Active;
     Archived    = objectToCopy.Archived;
     Author      = objectToCopy.Author;
     Date        = objectToCopy.Date;
     Featured    = objectToCopy.Featured;
     NewsPressID = objectToCopy.NewsPressID;
     StoryHTML   = objectToCopy.StoryHTML;
     Summary     = objectToCopy.Summary;
     Title       = objectToCopy.Title;
 }