protected IEnumerable<LogEntry> FindEntries(int lastReadEntryId) { var currentEntries = new LogRepository(ConnectionStringName).GetEntries(lastReadEntryId).OrderByDescending(e => e.ID); if (currentEntries.Any()) { // Update the LastReadEntryId int latestEntryId = currentEntries.First().ID; if (latestEntryId > LastReadEntryId) { LastReadEntryId = latestEntryId; } return currentEntries.Where( e => !string.IsNullOrEmpty(e.Exception) && e.Exception.Substring(0, SymConTimeoutException.Length) == SymConTimeoutException); } return Enumerable.Empty<LogEntry>(); }
private static int GetLatestLogEntryId() { var latestEntry = new LogRepository(ConnectionStringName).GetLatestEntry(); return latestEntry.ID; }