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