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