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