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