public IExecutableCommand MergeStatisticsChain(MergeNormalizedStatementStatisticsContext 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(MergeNormalizedStatementStatisticsContext context) { return(new MergeStatisticsCommand <long, NormalizedStatementStatistics>(context, () => new NormalizedStatementStatisticsSampler(context.DateTimeSelector, null))); }
public IChainableCommand LoadStatisticsForMergeCommand(MergeNormalizedStatementStatisticsContext context) { var repository = dalRepositories.GetNormalizedStatementStatisticsRepository(); return(new LoadStatisticsForMergeCommand <long, NormalizedStatementStatistics>(context, (from, to) => repository.GetAllGroupedByStatement(from, to))); }
public IChainableCommand SaveMergedStatisticsCommand(MergeNormalizedStatementStatisticsContext context) { var repository = dalRepositories.GetNormalizedStatementStatisticsRepository(); return(new SaveMergedStatisticsCommand <long, NormalizedStatementStatistics>(context, x => repository.Remove(x), x => repository.Create(x))); }