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