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