public List <int> ExecuteNonQuery(bool serial, ExecutionContext executionContext, CancellationToken cancellationToken = new CancellationToken())
        {
            var executor = new AdoNetShardingExecutor <int>();

            executor.OnCommandSqlExecute += DoExecuteNonQuery;
            return(ShardingExecute <int>(executor, serial, executionContext, cancellationToken));
        }
        public List <IStreamDataReader> ExecuteDbDataReader(bool serial, ExecutionContext executionContext,
                                                            CancellationToken cancellationToken = new CancellationToken())
        {
            var executor = new AdoNetShardingExecutor <IStreamDataReader>();

            executor.OnCommandSqlExecute += GetQueryEnumerator;

            return(ShardingExecute <IStreamDataReader>(executor, serial, executionContext, cancellationToken));
        }
Exemplo n.º 3
0
 public void Init(ExecutionContext executionContext)
 {
     SqlCommandContext = executionContext.GetSqlCommandContext();
     InputGroups.AddAll(GetExecuteGroups(executionContext.GetExecutionUnits()));
     CacheCommands();
 }
        private List <TResult> ShardingExecute <TResult>(IExecutor <TResult> executor, bool serial, ExecutionContext executionContext,
                                                         CancellationToken cancellationToken = new CancellationToken())
        {
            var waitSqlExecuteResults = executionContext.GetExecutionUnits().GroupBy(o => o.GetDataSourceName())
                                        .Select(o => GetSqlExecutorGroups(serial, o))
                                        .Select(dataSourceSqlExecutorUnit => { return(executor.Execute(dataSourceSqlExecutorUnit)); })
                                        .ToArray();
            var r = waitSqlExecuteResults.SelectMany(o => o).ToList();

            return(r);
        }