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