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