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