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