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