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