Browse Source
Update AbpDesignTimeDbContextBase.cs
pull/12289/head
maliming
4 years ago
No known key found for this signature in database
GPG Key ID: 96224957E51C89E
1 changed files with
12 additions and
2 deletions
-
framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/Design/AbpDesignTimeDbContextBase.cs
|
|
|
@ -19,11 +19,21 @@ public abstract class AbpDesignTimeDbContextBase<TModule, TContext> : IDesignTim |
|
|
|
|
|
|
|
protected virtual async Task<TContext> CreateDbContextAsync(string[] args) |
|
|
|
{ |
|
|
|
var application = await AbpApplicationFactory.CreateAsync<TModule>(); |
|
|
|
application.Services.ReplaceConfiguration(BuildConfiguration()); |
|
|
|
var application = await AbpApplicationFactory.CreateAsync<TModule>(options => |
|
|
|
{ |
|
|
|
options.Services.ReplaceConfiguration(BuildConfiguration()); |
|
|
|
ConfigureServices(options.Services); |
|
|
|
}); |
|
|
|
|
|
|
|
await application.InitializeAsync(); |
|
|
|
|
|
|
|
return application.ServiceProvider.GetRequiredService<TContext>(); |
|
|
|
} |
|
|
|
|
|
|
|
protected virtual void ConfigureServices(IServiceCollection services) |
|
|
|
{ |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
protected abstract IConfigurationRoot BuildConfiguration(); |
|
|
|
} |
|
|
|
|