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