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