Ejemplo n.º 1
0
 private void CheckSubQueryShardingValues(ISqlCommandContext <ISqlCommand> sqlStatementContext, ShardingRule shardingRule, ShardingConditions shardingConditions)
 {
     foreach (var tableName in sqlStatementContext.GetTablesContext().GetTableNames())
     {
         var tableRule = shardingRule.FindTableRule(tableName);
         if (tableRule != null && IsRoutingByHint(shardingRule, tableRule) &&
             HintManager.GetDatabaseShardingValues(tableName).Any() && HintManager.GetTableShardingValues(tableName).Any())
         {
             return;
         }
     }
     ShardingAssert.If(shardingConditions.Conditions.IsEmpty(), "Must have sharding column with subquery.");
     if (shardingConditions.Conditions.Count > 1)
     {
         ShardingAssert.Else(IsSameShardingCondition(shardingRule, shardingConditions), "Sharding value must same with subquery.");
     }
 }
 private List <IRouteValue> GetTableShardingValuesFromHint()
 {
     return(GetRouteValues(HintManager.GetTableShardingValues(LogicTableName)));
 }