public StreamMergeContext(IQueryable <T> source, IEnumerable <RouteResult> routeResults,
                                  IShardingParallelDbContextFactory shardingParallelDbContextFactory, IShardingScopeFactory shardingScopeFactory)
        {
            _shardingParallelDbContextFactory = shardingParallelDbContextFactory;
            _shardingScopeFactory             = shardingScopeFactory;
            _source      = source;
            RouteResults = routeResults;
            var reWriteResult = new ReWriteEngine <T>(source).ReWrite();

            Skip           = reWriteResult.Skip;
            Take           = reWriteResult.Take;
            Orders         = reWriteResult.Orders ?? Enumerable.Empty <PropertyOrder>();
            SelectContext  = reWriteResult.SelectContext;
            GroupByContext = reWriteResult.GroupByContext;
            _reWriteSource = reWriteResult.ReWriteQueryable;
        }
 public StreamMergeContextFactory(IShardingParallelDbContextFactory shardingParallelDbContextFactory, IShardingScopeFactory shardingScopeFactory, IRoutingRuleEngineFactory routingRuleEngineFactory)
 {
     _shardingParallelDbContextFactory = shardingParallelDbContextFactory;
     _shardingScopeFactory             = shardingScopeFactory;
     _routingRuleEngineFactory         = routingRuleEngineFactory;
 }