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