public DbSet <TEntity> CreateSet(DbConfig config, DbMode mode) { if (_dbContext == null) { _dbContext = _contextFactory.Create(_dbFactory.GetDbInitContext(typeof(TEntity), mode, config)); } return(_dbContext.Set <TEntity>()); }
public void Dispose() { if (_isDisposed) { return; } _dbContext?.Dispose(); _contextFactory.DisposeDbContext(_dbContext?.CacheKey); _dbContext = null; _isDisposed = true; }
public ContextFactory() { if (_creator == null) { _creator = (item, context) => { var dbContext = new CoralDbContext(context); return(dbContext); } } ; }