private void OpenDatabase() { var cfg = PersistenceConfig.GetOrCreateDbConfiguration(this.DataSource.Name, false); _dbContext = cfg.CreateDbContext(); this.AddDisposable(_dbContext); // base.SetConnectionState(true); }
protected override void OnOpen() { this.DbConfig = PersistenceConfig.GetOrCreateDbConfiguration(this.DataSource.Name, false); // _scheduler = new ActiveObjectImpl(string.Format($"远程DB-{this.DataSource.Name} Scheudler线程")); this.AddDisposable(_scheduler); _scheduler.Start(); // 创建一个ConnectionMonitor并打开。 this.OpenDbConnectionMonitor(); }
private IDatabase OpenDatabase(string dbSourceName) { var cfg = PersistenceConfig.GetOrCreateDbConfiguration(dbSourceName, true); return(cfg.Open()); }
public DbConfiguration GetConfig <T>() where T : Entity { var dataSource = PersistenceConfig.GetDataSource(typeof(T)); return(PersistenceConfig.GetOrCreateDbConfiguration(dataSource.Name, false)); }