public FrameworkDbContext CreateDbContext(string[] args) { var builder = new DbContextOptionsBuilder <FrameworkDbContext>(); var configuration = AppConfigurations.Get(WebContentDirectoryFinder.CalculateContentRootFolder(), addUserSecrets: true); FrameworkDbContextConfigurer.Configure(builder, configuration.GetConnectionString(FrameworkConsts.ConnectionStringName)); return(new FrameworkDbContext(builder.Options)); }
public override void PreInitialize() { if (!SkipDbContextRegistration) { Configuration.Modules.AbpEfCore().AddDbContext <FrameworkDbContext>(options => { if (options.ExistingConnection != null) { FrameworkDbContextConfigurer.Configure(options.DbContextOptions, options.ExistingConnection); } else { FrameworkDbContextConfigurer.Configure(options.DbContextOptions, options.ConnectionString); } }); } // Uncomment below line to write change logs for the entities below: // Because of https://github.com/aspnetboilerplate/aspnetboilerplate/issues/4948, below configuration will not work // Just add [Audited] attribute to Entities you want to enabled EntityHistory for until ABP 4.11 is released. //Configuration.EntityHistory.Selectors.Add("FrameworkEntities", EntityHistoryHelper.TrackedTypes); //Configuration.CustomConfigProviders.Add(new EntityHistoryConfigProvider(Configuration)); }