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