예제 #1
0
        public IShardingConfigBuilder AddAbsDb(string absDbName, Action <IAddAbstractTable> absTableBuilder)
        {
            var builder = new ShardingConfigBootstrapper();

            absTableBuilder(builder);
            var asbTables = builder.GetPropertyValue("_absTables") as List <AbstractTable>;

            _config.AddAbsDatabase(absDbName, asbTables);

            return(this);
        }
예제 #2
0
        public IShardingConfigBuilder AddDataSource(string dataSourceName, DatabaseType dbType, Action <IAddPhysicDb> physicDbBuilder)
        {
            IAddPhysicDb builder = new ShardingConfigBootstrapper();

            physicDbBuilder(builder);
            var value = builder.GetPropertyValue("_physicDbs") as List <(string conString, ReadWriteType opType)>;

            _config.AddDataSource(dataSourceName, dbType, value);

            return(this);
        }
예제 #3
0
        void IAddAbstractTable.AddAbsTable(string absTableName, Action <IAddPhysicTable> physicTableBuilder, Func <object, string> findTable)
        {
            IAddPhysicTable physicBuilder = new ShardingConfigBootstrapper();

            physicTableBuilder(physicBuilder);
            var value = physicBuilder.GetPropertyValue("_physicTables") as List <(string physicTableName, string dataSourceName)>;

            _absTables.Add(new AbstractTable
            {
                AbsTableName = absTableName,
                FindTable    = findTable,
                PhysicTables = value
            });
        }