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