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