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