Example #1
0
        private void PersistTotalIndexStatistics(TotalIndexStatistics newStatistics)
        {
            var repository = repositories.GetTotalIndexStatisticsRepository();
            var uniqueKey  = new TotalIndexStatisticsUniqueKey()
            {
                DatabaseID = newStatistics.DatabaseID,
                Date       = newStatistics.Date,
                IndexID    = newStatistics.IndexID,
                RelationID = newStatistics.RelationID
            };
            var oldStatistics = repository.GetByUniqueKey(uniqueKey);

            if (oldStatistics == null)
            {
                repository.Create(newStatistics);
            }
            else
            {
                TotalIndexStatisticsMergeUtility.ApplySample(oldStatistics, newStatistics);
                repository.Update(oldStatistics);
            }
        }
 protected override void ApplySampling(TotalIndexStatistics cumulativeData, TotalIndexStatistics newSample)
 {
     TotalIndexStatisticsMergeUtility.ApplySample(cumulativeData, newSample);
 }