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