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