예제 #1
0
		public void AddStatementExecution(StatementExecutionHistoryEntry entry)
		{
			var maximumHistoryEntries = ConfigurationProvider.Configuration.Miscellaneous.MaximumHistoryEntries;

			if (!StatementExecutionHistory.Remove(entry) && StatementExecutionHistory.Count >= maximumHistoryEntries)
			{
				var recordsToRemove = StatementExecutionHistory.OrderByDescending(r => r.ExecutedAt).Skip(maximumHistoryEntries - 1).ToArray();
				foreach (var oldRecord in recordsToRemove)
				{
					StatementExecutionHistory.Remove(oldRecord);
				}

				Trace.WriteLine($"Statement execution history limit of {maximumHistoryEntries} entries has been reached. Oldest entries have been removed. ");
			}

			StatementExecutionHistory.Add(entry);
		}
예제 #2
0
        public void AddStatementExecution(StatementExecutionHistoryEntry entry)
        {
            var maximumHistoryEntries = ConfigurationProvider.Configuration.Miscellaneous.MaximumHistoryEntries;

            if (!StatementExecutionHistory.Remove(entry) && StatementExecutionHistory.Count >= maximumHistoryEntries)
            {
                var recordsToRemove = StatementExecutionHistory.OrderByDescending(r => r.ExecutedAt).Skip(maximumHistoryEntries - 1).ToArray();
                foreach (var oldRecord in recordsToRemove)
                {
                    StatementExecutionHistory.Remove(oldRecord);
                }

                TraceLog.WriteLine($"Statement execution history limit of {maximumHistoryEntries} entries has been reached. Oldest entries have been removed. ");
            }

            StatementExecutionHistory.Add(entry);
        }
예제 #3
0
        private void UpdateHistoryEntries()
        {
            var maximumHistoryEntrySize = ConfigurationProvider.Configuration.Miscellaneous.MaximumHistoryEntrySize;

            foreach (var statementResult in _executionResult.StatementResults.Where(r => r.ExecutedAt.HasValue))
            {
                var executionHistoryRecord = new StatementExecutionHistoryEntry(statementResult.StatementModel.StatementText, statementResult.ExecutedAt.Value);

                if (executionHistoryRecord.StatementText.Length <= maximumHistoryEntrySize)
                {
                    _providerConfiguration.AddStatementExecution(executionHistoryRecord);
                }
                else
                {
                    TraceLog.WriteLine($"Executed statement not stored in the execution history. The maximum allowed size is {maximumHistoryEntrySize} characters while the statement has {executionHistoryRecord.StatementText.Length} characters. ");
                }
            }
        }
예제 #4
0
 public void RemoveStatementExecutionHistoryEntry(StatementExecutionHistoryEntry entry)
 {
     StatementExecutionHistory.Remove(entry);
 }
예제 #5
0
 protected bool Equals(StatementExecutionHistoryEntry other)
 {
     return(String.Equals(StatementText, other.StatementText));
 }
예제 #6
0
		public void RemoveStatementExecutionHistoryEntry(StatementExecutionHistoryEntry entry)
		{
			StatementExecutionHistory.Remove(entry);
		}
예제 #7
0
		protected bool Equals(StatementExecutionHistoryEntry other)
		{
			return String.Equals(StatementText, other.StatementText);
		}
예제 #8
0
		private void UpdateHistoryEntries()
		{
			var maximumHistoryEntrySize = ConfigurationProvider.Configuration.Miscellaneous.MaximumHistoryEntrySize;

			foreach (var statementResult in _executionResult.StatementResults.Where(r => r.ExecutedAt.HasValue))
			{
				var executionHistoryRecord = new StatementExecutionHistoryEntry(statementResult.StatementModel.StatementText, statementResult.ExecutedAt.Value);

				if (executionHistoryRecord.StatementText.Length <= maximumHistoryEntrySize)
				{
					_providerConfiguration.AddStatementExecution(executionHistoryRecord);
				}
				else
				{
					Trace.WriteLine($"Executed statement not stored in the execution history. The maximum allowed size is {maximumHistoryEntrySize} characters while the statement has {executionHistoryRecord.StatementText.Length} characters. ");
				}
			}
		}