public BookStoreDbContext Create(DbContextFactoryOptions options) { var builder = new DbContextOptionsBuilder <BookStoreDbContext>(); var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder()); BookStoreDbContextConfigurer.Configure(builder, configuration.GetConnectionString(BookStoreConsts.ConnectionStringName)); return(new BookStoreDbContext(builder.Options)); }
public override void PreInitialize() { if (!SkipDbContextRegistration) { Configuration.Modules.AbpEfCore().AddDbContext <BookStoreDbContext>(configuration => { BookStoreDbContextConfigurer.Configure(configuration.DbContextOptions, configuration.ConnectionString); }); } }
public override void PreInitialize() { if (!SkipDbContextRegistration) { Configuration.Modules.AbpEfCore().AddDbContext <BookStoreDbContext>(options => { if (options.ExistingConnection != null) { BookStoreDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection); } else { BookStoreDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString); } }); } }