示例#1
0
        private void OpenDatabase()
        {
            var cfg = PersistenceConfig.GetOrCreateDbConfiguration(this.DataSource.Name, false);

            _dbContext = cfg.CreateDbContext();
            this.AddDisposable(_dbContext);

            //
            base.SetConnectionState(true);
        }
示例#2
0
        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());
        }
示例#4
0
        public DbConfiguration GetConfig <T>() where T : Entity
        {
            var dataSource = PersistenceConfig.GetDataSource(typeof(T));

            return(PersistenceConfig.GetOrCreateDbConfiguration(dataSource.Name, false));
        }