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