Exemplo n.º 1
0
        public async Task RemoveEndpointStatsByDaysToKeep(int daysToKeep)
        {
            await using var context = new EpMonContext();

            var minDate = DateTime.UtcNow.AddDays(-daysToKeep);

            await context.Database.ExecuteSqlRawAsync($"DELETE FROM EndpointStats WHERE TimeStamp <= '{minDate.ToString("yyyy-MM-dd HH:mm:ss")}'");

            await context.SaveChangesAsync();
        }
Exemplo n.º 2
0
 public void AddEndpointStat(EndpointStat stat)
 {
     using var context = new EpMonContext();
     context.EndpointStats.Add(new EndpointStat
     {
         EndpointId   = stat.EndpointId,
         IsHealthy    = stat.IsHealthy,
         Message      = stat.Message,
         ResponseTime = stat.ResponseTime,
         TimeStamp    = stat.TimeStamp,
         Status       = stat.Status
     });
     context.SaveChanges();
 }
Exemplo n.º 3
0
 public EndpointStore(EpMonContext context)
 {
     _context = context;
 }