Exemplo n.º 1
0
        public static NewsPressNewsPressCategory GetByID(int NewsPressNewsPressCategoryID, IEnumerable <string> includeList = null)
        {
            NewsPressNewsPressCategory obj = null;
            string key = cacheKeyPrefix + NewsPressNewsPressCategoryID + GetCacheIncludeText(includeList);

            NewsPressNewsPressCategory tmpClass = null;

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

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

            return(obj);
        }
Exemplo n.º 2
0
 public NewsPressNewsPressCategory(NewsPressNewsPressCategory objectToCopy)
 {
     NewsPressCategoryID          = objectToCopy.NewsPressCategoryID;
     NewsPressID                  = objectToCopy.NewsPressID;
     NewsPressNewsPressCategoryID = objectToCopy.NewsPressNewsPressCategoryID;
 }