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