Esempio n. 1
0
 //public IEnumerable<DbContext> GetAllDbContexts()
 //{
 //    SimpleDbContextStorage storage = GetSimpleDbContextStorage();
 //    return storage.GetAllDbContexts();
 //}
 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. 2
0
        //public IEnumerable<DbContext> GetAllDbContexts()
        //{
        //    SimpleDbContextStorage storage = GetSimpleDbContextStorage();
        //    return storage.GetAllDbContexts();
        //}

        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
        public void SetDbContextFactoryForKey(string factoryKey, IEFContextFactory <DbContext> context)
        {
            SimpleDbContextStorage storage = GetSimpleDbContextStorage();

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

            return(storage.GetDbContextForKey(key));
        }
Esempio n. 5
0
        public IEnumerable <DbContext> GetAllDbContexts()
        {
            SimpleDbContextStorage storage = GetSimpleDbContextStorage();

            return(storage.GetAllDbContexts());
        }