Esempio n. 1
0
        public void Clear()
        {
            HttpContext            context = HttpContext.Current;
            SimpleDbContextStorage storage = context.Items[STORAGE_KEY] as SimpleDbContextStorage;

            if (storage != null)
            {
                storage.Clear();
            }
        }
 private SimpleDbContextStorage GetSimpleDbContextStorage()
 {
     HttpContext context = HttpContext.Current;
     SimpleDbContextStorage storage = context.Items[STORAGE_KEY] as SimpleDbContextStorage;
     if (storage == null)
     {
         storage = new SimpleDbContextStorage();
         context.Items[STORAGE_KEY] = storage;
     }
     return storage;
 }
Esempio n. 3
0
        private SimpleDbContextStorage GetSimpleDbContextStorage()
        {
            HttpContext            context = HttpContext.Current;
            SimpleDbContextStorage storage = context.Items[STORAGE_KEY] as SimpleDbContextStorage;

            if (storage == null)
            {
                storage = new SimpleDbContextStorage();
                context.Items[STORAGE_KEY] = storage;
            }
            return(storage);
        }
Esempio n. 4
0
        public IEnumerable <DbContext> GetAllDbContexts()
        {
            SimpleDbContextStorage storage = GetSimpleDbContextStorage();

            return(storage.GetAllDbContexts());
        }
Esempio n. 5
0
        public void SetDbContextForKey(string factoryKey, DbContext context)
        {
            SimpleDbContextStorage storage = GetSimpleDbContextStorage();

            storage.SetDbContextForKey(factoryKey, context);
        }
Esempio n. 6
0
        public DbContext GetDbContextForKey(string key)
        {
            SimpleDbContextStorage storage = GetSimpleDbContextStorage();

            return(storage.GetDbContextForKey(key));
        }