public IExecutableCommand MergeStatisticsChain(MergeNormalizedStatementIndexStatisticsContext context)
        {
            CommandChainCreator chain = new CommandChainCreator();

            chain.Add(commands.LoadStatisticsForMergeCommand(context));
            chain.Add(commands.MergeStatisticsCommand(context));
            chain.Add(commands.SaveMergedStatisticsCommand(context));
            return(chain.FirstCommand);
        }
 public IChainableCommand MergeStatisticsCommand(MergeNormalizedStatementIndexStatisticsContext context)
 {
     return(new MergeStatisticsCommand <long, NormalizedStatementIndexStatistics>(context, () => new NormalizedStatementIndexStatisticsSampler(context.DateTimeSelector, null)));
 }
        public IChainableCommand LoadStatisticsForMergeCommand(MergeNormalizedStatementIndexStatisticsContext context)
        {
            var repository = dalRepositories.GetNormalizedStatementIndexStatisticsRepository();

            return(new LoadStatisticsForMergeCommand <long, NormalizedStatementIndexStatistics>(context, (from, to) => repository.GetAllGroupedByStatement(from, to)));
        }
        public IChainableCommand SaveMergedStatisticsCommand(MergeNormalizedStatementIndexStatisticsContext context)
        {
            var repository = dalRepositories.GetNormalizedStatementIndexStatisticsRepository();

            return(new SaveMergedStatisticsCommand <long, NormalizedStatementIndexStatistics>(context, x => repository.Remove(x), x => repository.Create(x)));
        }