public static NewsletterFormat GetByID(int NewsletterFormatID, IEnumerable <string> includeList = null) { NewsletterFormat obj = null; string key = cacheKeyPrefix + NewsletterFormatID + GetCacheIncludeText(includeList); NewsletterFormat tmpClass = null; if (Cache.IsEnabled) { if (Cache.IsEmptyCacheItem(key)) { return(null); } tmpClass = Cache[key] as NewsletterFormat; } if (tmpClass != null) { obj = tmpClass; } else { using (Entities entity = new Entities()) { IQueryable <NewsletterFormat> itemQuery = AddIncludes(entity.NewsletterFormat, includeList); obj = itemQuery.FirstOrDefault(n => n.NewsletterFormatID == NewsletterFormatID); } Cache.Store(key, obj); } return(obj); }
public NewsletterFormat(NewsletterFormat objectToCopy) { Name = objectToCopy.Name; NewsletterFormatID = objectToCopy.NewsletterFormatID; }