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