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