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