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