Esempio n. 1
0
        private void PersistStatementStatistics(NormalizedStatementStatistics newStatistics)
        {
            var repository = repositories.GetNormalizedStatementStatisticsRepository();
            var uniqueKey  = new NormalizedStatementStatisticsUniqueKey()
            {
                ApplicationName       = newStatistics.ApplicationName,
                DatabaseID            = newStatistics.DatabaseID,
                Date                  = newStatistics.Date,
                NormalizedStatementID = newStatistics.NormalizedStatementID,
                UserName              = newStatistics.UserName
            };
            var oldStatistics = repository.GetByUniqueKey(uniqueKey);

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