public static object Retrieve(ApplicationItemContainerKey key) { if (HttpContext.Current != null && HttpContext.Current.Application != null) { HttpApplicationState application = HttpContext.Current.Application; if (application[BuildKey(key)] != null) { return(application[BuildKey(key)]); } else { return(null); } } else { if (_fakeApplicationContainer.ContainsKey(BuildKey(key))) { return(_fakeApplicationContainer[BuildKey(key)]); } else { return(null); } } }
public static void Store(ApplicationItemContainerKey key, object value) { if (HttpContext.Current != null && HttpContext.Current.Application != null) { HttpContext.Current.Application[BuildKey(key)] = value; } else { _fakeApplicationContainer[BuildKey(key)] = value; } }
private static string BuildKey(ApplicationItemContainerKey key) { return(string.Format("{0}_{1}", KEY_PREFIX, key.ToString())); }