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