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); } }); } }