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