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