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