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