Ejemplo n.º 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);
		}
Ejemplo n.º 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);
        }
Ejemplo n.º 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. ");
                }
            }
        }
Ejemplo n.º 4
0
 public void RemoveStatementExecutionHistoryEntry(StatementExecutionHistoryEntry entry)
 {
     StatementExecutionHistory.Remove(entry);
 }
Ejemplo n.º 5
0
 protected bool Equals(StatementExecutionHistoryEntry other)
 {
     return(String.Equals(StatementText, other.StatementText));
 }
Ejemplo n.º 6
0
		public void RemoveStatementExecutionHistoryEntry(StatementExecutionHistoryEntry entry)
		{
			StatementExecutionHistory.Remove(entry);
		}
Ejemplo n.º 7
0
		protected bool Equals(StatementExecutionHistoryEntry other)
		{
			return String.Equals(StatementText, other.StatementText);
		}
Ejemplo n.º 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. ");
				}
			}
		}