public PMSDemoDbContext CreateDbContext(string[] args) { var builder = new DbContextOptionsBuilder <PMSDemoDbContext>(); var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder(), addUserSecrets: true); PMSDemoDbContextConfigurer.Configure(builder, configuration.GetConnectionString(PMSDemoConsts.ConnectionStringName)); return(new PMSDemoDbContext(builder.Options)); }
public override void PreInitialize() { if (!SkipDbContextRegistration) { Configuration.Modules.AbpEfCore().AddDbContext <PMSDemoDbContext>(options => { if (options.ExistingConnection != null) { PMSDemoDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection); } else { PMSDemoDbContextConfigurer.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("PMSDemoEntities", EntityHistoryHelper.TrackedTypes); Configuration.CustomConfigProviders.Add(new EntityHistoryConfigProvider(Configuration)); }