public RouteResult Route(ShardingRule shardingRule)
 {
     if (IsDMLForModify(SqlCommandContext) && 1 != ((ITableAvailable)SqlCommandContext).GetAllTables().Count)
     {
         throw new ShardingException($"Cannot support Multiple-Table for '{SqlCommandContext.GetSqlCommand()}'.");
     }
     return(GenerateRouteResult(GetDataNodes(shardingRule, shardingRule.GetTableRule(LogicTableName))));
 }
Beispiel #2
0
        public ICommandContext CreateCommand(string text, CommandType commandType, ITransaction transaction)
        {
            var command = new SqlCommandContext(Connection, text, commandType, transaction);

            return command;
        }
Beispiel #3
0
        public ICommandContext CreateCommand(string text)
        {
            var command = new SqlCommandContext(Connection, text, CommandType.StoredProcedure);

            return command;
        }