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