public static object Get(AppStateKeys key, object defaultValue = null) {
     string keyString = Enum.GetName(typeof (AppStateKeys), key);
     if (HttpContext.Current.Application[keyString] == null && defaultValue != null) {
         HttpContext.Current.Application[keyString] = defaultValue;
     }
     return HttpContext.Current.Application[keyString];
 }
        public static int IncrementAndGet(AppStateKeys key)
        {
            string keyString           = Enum.GetName(typeof(AppStateKeys), key);
            HttpApplicationState state = HttpContext.Current.Application;

            return((int)(state[keyString] = ((int)(state[keyString] ?? 0) + 1)));
        }
Beispiel #3
0
        public static object Get(AppStateKeys key, object defaultValue = null)
        {
            string keyString = Enum.GetName(typeof(AppStateKeys), key);

            if (HttpContext.Current.Application[keyString] == null &&
                defaultValue != null)
            {
                HttpContext.Current.Application[keyString] = defaultValue;
            }
            return(HttpContext.Current.Application[keyString]);
        }
Beispiel #4
0
        public static object Set(AppStateKeys key, object value)
        {
            var appState = HttpContext.Current.Application;

            appState.Lock();

            appState[Enum.GetName(typeof(AppStateKeys), key)] = value;

            appState.UnLock();

            return(appState[Enum.GetName(typeof(AppStateKeys), key)]);
        }
Beispiel #5
0
        public static object Get(AppStateKeys key, object defaultValue = null)
        {
            var    appState  = HttpContext.Current.Application;
            string keyString = Enum.GetName(typeof(AppStateKeys), key);

            appState.Lock();

            if (appState[keyString] == null && defaultValue != null)
            {
                appState[keyString] = defaultValue;
            }

            appState.UnLock();

            return(appState[keyString]);
        }
 public static int IncrementAndGet(AppStateKeys key) {
     string keyString = Enum.GetName(typeof(AppStateKeys), key);
     HttpApplicationState state = HttpContext.Current.Application;
     return (int)(state[keyString] = ((int)(state[keyString] ?? 0) + 1));
 }
Beispiel #7
0
 public static object Set(AppStateKeys key, object value)
 {
     return(HttpContext.Current.Application[Enum.GetName(typeof(AppStateKeys),
                                                         key)] = value);
 }
 public static object Set(AppStateKeys key, object value) {
     return HttpContext.Current.Application[Enum.GetName(typeof(AppStateKeys),
         key)] = value;
 }
 public static object Set(AppStateKeys key, object value) {
     string keyString = Enum.GetName(typeof(AppStateKeys), key);            
     return HttpContext.Current.Application[keyString] = value;
 }