static void Main(string[] args) { var configuration = GetConfiguration(); try { var bastaConfig = configuration.GetBastaAPIConfig(); var contextOptions = new DbContextOptionsBuilder <BASTAContext>() .UseSqlServer(bastaConfig.DatabaseConnectionString) .Options; using var ctx = new BASTAContext(contextOptions); var oldLogs = ctx .AuditLogs .Where(al => al.TimeStamp < DateTime.UtcNow.AddDays(bastaConfig.AuditLogRetentionDays)); ctx.RemoveRange(oldLogs); ctx.SaveChanges(); Console.WriteLine("Audit Log cleaned up."); } catch (Exception exception) { Console.WriteLine($"ERROR while removing old AuditLogs."); Console.WriteLine(exception.Message); Console.WriteLine(exception.StackTrace); } }
public AuditLogRepository(BASTAContext context) { Context = context; }
public SessionsRepository(BASTAContext context) { Context = context; }
public SpeakersRepository(BASTAContext context) { Context = context; }
public AudiencesRepository(BASTAContext context) { Context = context; }