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