protected EFRepositoryBase(IDbContextFactory dbContextFactory)
 {
     if (_context == null)
     {
         _context = dbContextFactory.CreateInstance(typeof(TContext));
     }
     _type = typeof(TEntity);
 }
Beispiel #2
0
        protected EFRepositoryBase(IDbContextFactory dbContextFactory)
        {
            _dbContextFactory = dbContextFactory;
            if (_context == null)
            {
                _context = _dbContextFactory.CreateInstance(typeof(NebulaNpgEntityContext));
            }

            _type = typeof(TEntity);
        }
        public StaticDbContextPool(IDbContextFactory <T> contextFactory, int size)
        {
            if (contextFactory == null)
            {
                throw new ArgumentNullException(nameof(contextFactory));
            }

            this.allItems = Enumerable.Range(0, size).Select(i => contextFactory.CreateInstance()).ToList();
            this.items    = new AsyncProducerConsumerQueue <T>(allItems);
        }