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