private List <IRouteValue> GetTableShardingValues(ShardingRule shardingRule, TableRule tableRule, ShardingCondition shardingCondition)
        {
            IShardingStrategy tableShardingStrategy = shardingRule.GetTableShardingStrategy(tableRule);

            return(IsGettingShardingValuesFromHint(tableShardingStrategy)
                    ? GetTableShardingValuesFromHint() : GetShardingValuesFromShardingConditions(shardingRule, tableShardingStrategy.GetShardingColumns(), shardingCondition));
        }
        private ICollection <DataNode> RouteTables(ShardingRule shardingRule, TableRule tableRule, string routedDataSource, List <IRouteValue> tableShardingValues)
        {
            ICollection <string> availableTargetTables = tableRule.GetActualTableNames(routedDataSource);
            ICollection <string> routedTables          = new HashSet <string>(tableShardingValues.IsEmpty() ? availableTargetTables
                    : shardingRule.GetTableShardingStrategy(tableRule).DoSharding(availableTargetTables, tableShardingValues, this.Properties));

            ShardingAssert.If(routedTables.IsEmpty(), "no table route info");
            ICollection <DataNode> result = new LinkedList <DataNode>();

            foreach (var routedTable in routedTables)
            {
                result.Add(new DataNode(routedDataSource, routedTable));
            }
            return(result);
        }
 private bool IsRoutingByShardingConditions(ShardingRule shardingRule, TableRule tableRule)
 {
     return(!(shardingRule.GetDatabaseShardingStrategy(tableRule) is HintShardingStrategy || shardingRule.GetTableShardingStrategy(tableRule) is HintShardingStrategy));
 }
        private ICollection <DataNode> RouteByShardingConditionsWithCondition(ShardingRule shardingRule, TableRule tableRule)
        {
            ICollection <DataNode> result = new LinkedList <DataNode>();

            foreach (var condition in ShardingConditions.Conditions)
            {
                ICollection <DataNode> dataNodes = Route0(shardingRule, tableRule,
                                                          GetShardingValuesFromShardingConditions(shardingRule, shardingRule.GetDatabaseShardingStrategy(tableRule).GetShardingColumns(), condition),
                                                          GetShardingValuesFromShardingConditions(shardingRule, shardingRule.GetTableShardingStrategy(tableRule).GetShardingColumns(), condition));
                result.AddAll(dataNodes);
                OriginalDataNodes.Add(dataNodes);
            }
            return(result);
        }
 private bool IsRoutingByHint(ShardingRule shardingRule, TableRule tableRule)
 {
     return(shardingRule.GetDatabaseShardingStrategy(tableRule) is HintShardingStrategy && shardingRule.GetTableShardingStrategy(tableRule) is HintShardingStrategy);
 }