public IExecutableCommand MergeStatisticsChain(MergeNormalizedStatementRelationStatisticsContext 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(MergeNormalizedStatementRelationStatisticsContext context)
 {
     return(new MergeStatisticsCommand <long, NormalizedStatementRelationStatistics>(context, () => new NormalizedStatementRelationStatisticsSampler(context.DateTimeSelector, null)));
 }
        public IChainableCommand LoadStatisticsForMergeCommand(MergeNormalizedStatementRelationStatisticsContext context)
        {
            var repository = dalRepositories.GetNormalizedStatementRelationStatisticsRepository();

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

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