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