public ProductionDbContext CreateDbContext(string[] args) { var builder = new DbContextOptionsBuilder <ProductionDbContext>(); var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder(), addUserSecrets: true); ProductionDbContextConfigurer.Configure(builder, configuration.GetConnectionString(ProductionConsts.ConnectionStringName)); return(new ProductionDbContext(builder.Options)); }
public override void PreInitialize() { if (!SkipDbContextRegistration) { Configuration.Modules.AbpEfCore().AddDbContext <ProductionDbContext>(options => { if (options.ExistingConnection != null) { ProductionDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection); } else { ProductionDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString); } }); } // Uncomment below line to write change logs for the entities below: //Configuration.EntityHistory.Selectors.Add("ProductionEntities", EntityHistoryHelper.TrackedTypes); //Configuration.CustomConfigProviders.Add(new EntityHistoryConfigProvider(Configuration)); }