protected override void Setup(FeatureConfigurationContext context) { using (var startupDbContext = new InboxStartupDbContext()) { startupDbContext.InitializeDatabase(); } context.RegisterStartupTask(new InboxCleanupTask()); }
private void PerformCleanup(object state) { try { using (var startupDbContext = new InboxStartupDbContext()) { var time = DateTime.UtcNow - retentionPeriod; startupDbContext.RemoveEntriesOlderThan(time); log.Info($"Performing Inbox Cleanup for items older than {time}"); } } catch (Exception exception) { log.Error("Error when trying to remove old entries from Inbox", exception); } }