Exemple #1
0
        private void PersistStatementRelationStatistics(NormalizedStatementRelationStatistics newStatistics)
        {
            var repository = repositories.GetNormalizedStatementRelationStatisticsRepository();
            var uniqueKey  = new NormalizedStatementRelationStatisticsUniqueKey()
            {
                DatabaseID            = newStatistics.DatabaseID,
                Date                  = newStatistics.Date,
                RelationID            = newStatistics.RelationID,
                NormalizedStatementID = newStatistics.NormalizedStatementID
            };
            var oldStatistics = repository.GetByUniqueKey(uniqueKey);

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