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