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