From 6dda9a4f2e8eb50e4fffcee636a8ba281a483bcf Mon Sep 17 00:00:00 2001 From: gdlcf88 Date: Thu, 28 Dec 2023 00:48:38 +0800 Subject: [PATCH] Fix `DbMigratorHostedService` --- .../DbMigratorHostedService.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/samples/EShopSample/aspnet-core/src/EShopSample.DbMigrator/DbMigratorHostedService.cs b/samples/EShopSample/aspnet-core/src/EShopSample.DbMigrator/DbMigratorHostedService.cs index 3fc10cbf3..6fa0e8bf4 100644 --- a/samples/EShopSample/aspnet-core/src/EShopSample.DbMigrator/DbMigratorHostedService.cs +++ b/samples/EShopSample/aspnet-core/src/EShopSample.DbMigrator/DbMigratorHostedService.cs @@ -6,6 +6,7 @@ using Microsoft.Extensions.Hosting; using Serilog; using Volo.Abp; +using Volo.Abp.Data; namespace EShopSample.DbMigrator; @@ -23,11 +24,12 @@ public DbMigratorHostedService(IHostApplicationLifetime hostApplicationLifetime, public async Task StartAsync(CancellationToken cancellationToken) { using (var application = await AbpApplicationFactory.CreateAsync(options => - { - options.Services.ReplaceConfiguration(_configuration); - options.UseAutofac(); - options.Services.AddLogging(c => c.AddSerilog()); - })) + { + options.Services.ReplaceConfiguration(_configuration); + options.UseAutofac(); + options.Services.AddLogging(c => c.AddSerilog()); + options.AddDataMigrationEnvironment(); + })) { await application.InitializeAsync();