示例#1
0
        public async Task StartAsync(CancellationToken cancellationToken)
        {
            _logger.LogInformation("App Start at: {time}", DateTimeOffset.Now);

            var contextFactory = new TestContextFactory
            {
                Configuration = _configuration
            };

            await using (var dbContext = contextFactory.CreateDbContext(Array.Empty <string>()))
            {
                var db = dbContext.Database;
                await db.MigrateAsync(cancellationToken : cancellationToken);
            }

            _appLifetime.StopApplication();
        }