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