using EntrustSettle.Common; using Microsoft.AspNetCore.Builder; namespace EntrustSettle.Extensions.ServiceExtensions; public static class ApplicationSetup { public static void UseApplicationSetup(this WebApplication app) { app.Lifetime.ApplicationStarted.Register(() => { App.IsRun = true; }); app.Lifetime.ApplicationStopped.Register(() => { App.IsRun = false; NLog.LogManager.Flush(); NLog.LogManager.Shutdown(); }); } }