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