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