public override void PreInitialize() { if (!SkipDbContextRegistration) { Configuration.Modules.AbpEfCore().AddDbContext <MetroStationDbContext>(options => { if (options.ExistingConnection != null) { MetroStationDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection); } else { MetroStationDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString); } }); Configuration.Modules.AbpEfCore().AddDbContext <AuditLogDbContext>(options => { if (options.ExistingConnection != null) { AuditLogDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection); } else { AuditLogDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString); } }); } }
public AuditLogDbContext CreateDbContext(string[] args) { var builder = new DbContextOptionsBuilder <AuditLogDbContext>(); var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder()); AuditLogDbContextConfigurer.Configure(builder, configuration.GetConnectionString(MetroStationConsts.AuditLogConnectionStringName)); return(new AuditLogDbContext(builder.Options)); }