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